Ich verwende eine Homebrew-Installation von Python und erhalte einen Fehler bei der Verwendung von pip in einer virtualenvwrapper- Umgebung:
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Homebrew hat eine Formel für libffi ( brew install libffi
), die erfolgreich zu sein schien.
Ich kann rennen
$ python-config --include
was ergibt:
-I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7
Sollte ich also "das Verzeichnis hinzufügen, das `libffi.pc' enthält"?
echo $PKG_CONFIG_PATH
ergibt einen leeren String.
[Jemand auf SO hatte empfohlen][3]:
Use -I /opt/local/include on the command line
oder
C_INCLUDE_PATH=/opt/local/include in the environment.
Würde ich die Zeile hinzufügen:
C_INCLUDE_PATH=/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7
zum ~/.bash_profile
?
oder evtlexport PKG_CONFIG_PATH=/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7
Herausgefunden.
brew install libffi
locate libffi.pc
(in diesem Fall musste ich auch den Befehl ausführen, um die Locate-Datenbank zu erstellen, für die der Code in der Eingabeaufforderung von locate enthalten war)
ist zurückgekommen/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/libffi.pc
Dann innerhalb der virtualenv lief export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
(der Pfad zu libffi.pc
).
Bestätigt mit echo $PKG_CONFIG_PATH
, das den Pfad anzeigt.
Und pipp "Erfolgreich installiert" die Module!
Falls es nützlich ist, habe ich die virtualenvwrapper-Umgebung folgendermaßen zum Laufen gebracht:
Ich habe die folgenden Inhalte zu den ~/.bash_profile
sowie ~/.bashrc
Dateien hinzugefügt:
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PATH=/usr/local/bin:$PATH
Gemäß diesem Tutorial .
FWIW musste ich tatsächlich verwenden export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
, um dies zum Laufen zu bringen. Derselbe Befehl, aber nur das Verzeichnis anstelle der Datei libffi.pc selbst.
In meinem Fall bekam ich beim Ausführen von npm i die nächste Fehlermeldung:
node-gyp rebuild
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found
gyp: Call to 'pkg-config --cflags cairo poppler-qt5' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
I figured out the problem was on exporting the PATH
Also habe ich brew reinstall -s poppler ausgeführt
Am Ende der Installation können Sie den Export der Pfade durchführen
If you need to have qt first in your PATH run:
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc
For compilers to find qt you may need to set:
export LDFLAGS="-L/usr/local/opt/qt/lib"
export CPPFLAGS="-I/usr/local/opt/qt/include"
For pkg-config to find qt you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"
Dies hat es für mich behoben.
Ich hoffe, Sie finden es hilfreich.
DavidBoho
export PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig/"
Gio