Я пытался установить pycairo с pip3 на MacOs, но всякий раз, когда вы пытаетесь это сделать, появляется эта ошибка:
pip3 install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/0w/2v91jtp54jl7b4cdqrhk_96h0000gn/T/pip-install-uiqmlfkz/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/0w/2v91jtp54jl7b4cdqrhk_96h0000gn/T/pip-record-egwlnpkb/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.9-x86_64-3.7/cairo
running build_ext
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
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/0w/2v91jtp54jl7b4cdqrhk_96h0000gn/T/pip-install-uiqmlfkz/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/0w/2v91jtp54jl7b4cdqrhk_96h0000gn/T/pip-record-egwlnpkb/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0w/2v91jtp54jl7b4cdqrhk_96h0000gn/T/pip-install-uiqmlfkz/pycairo/
Я установил cairo и pkg-config с помощью brew.
Обновление, я установил путь PKG_CONFIG_PATH, используя следующую команду
export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.2.1/lib/pkgconfig/
И позже, используя pip3 для установки pycairo, он делает свою работу. Единственное, даже если он установлен сейчас, python3 не находит pycairo.
python3
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycairo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pycairo'
У меня установлено следующее с brew
brew list
aom jpeg p11-kit
atk lame pango
cairo leptonica pcre
ffmpeg libass pixman
flac libbluray pkg-config
fontconfig libevent python
freetype libffi readline
frei0r libogg rtmpdump
fribidi libpng rubberband
gdbm libsamplerate sdl2
gdk-pixbuf libsndfile snappy
gettext libsoxr speex
ghostscript libtasn1 sqlite
giflib libtiff tesseract
glew libunistring theora
glib libvorbis unbound
gmp libvpx webp
gnutls little-cms2 x264
graphite2 nettle x265
gtk+ opencore-amr xvid
harfbuzz openjpeg xz
hicolor-icon-theme openssl
icu4c opus
и это мой список pip3
astroid 2.2.5
cairocffi 1.0.2
cffi 1.12.3
isort 4.3.16
lazy-object-proxy 1.3.1
mccabe 0.6.1
opencv-python 3.4.2.17
pip 19.1
pycairo 1.18.1 #it seems like it's installed but it doesn't recognize it whenever I try to import it
pycparser 2.19
pylint 2.3.1
setuptools 40.8.0
typed-ast 1.3.1
wrapt 1.11.1