MacOS下使用pip安装python的AppKit package,pip install AppKit
执行过程中报错,完整信息如下:
pip install AppKit
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting AppKit
Using cached https://files.pythonhosted.org/packages/8b/93/5d77e3cccb45a065e9853869af66cf9b09353f51c629cfe040d094620866/AppKit-0.2.8.tar.gz
Collecting flask (from AppKit)
Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
Collecting pygobject (from AppKit)
Using cached https://files.pythonhosted.org/packages/3e/b5/f4fd3351ed074aeeae30bff71428f38bc42187e34c44913239a9dc85a7fc/PyGObject-3.36.0.tar.gz
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /Library/Python/2.7/site-packages/pip-19.2.3-py2.7.egg/pip install --ignore-installed --no-user --prefix /private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-build-env-KEQPtW/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
cwd: None
Complete output (31 lines):
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/ab/b5/3679d7c98be5b65fa5522671ef437b792d909cf3908ba54fe9eca5d2a766/setuptools-44.1.0-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/3c/1a/c0478ecab31baae50fda9956547788afbd0ca563adc52c9b03cab30f17eb/pycairo-1.18.2.tar.gz
Installing collected packages: setuptools, wheel, pycairo
Running setup.py install for pycairo: started
Running setup.py install for pycairo: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-install-Yi9jsp/pycairo/setup.py'"'"'; __file__='"'"'/private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-install-Yi9jsp/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/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-record-50DnQO/install-record.txt --single-version-externally-managed --prefix /private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-build-env-KEQPtW/overlay --compile
cwd: /private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-install-Yi9jsp/pycairo/
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.14-intel-2.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.14-intel-2.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.14-intel-2.7/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-install-Yi9jsp/pycairo/setup.py'"'"'; __file__='"'"'/private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-install-Yi9jsp/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/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-record-50DnQO/install-record.txt --single-version-externally-managed --prefix /private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-build-env-KEQPtW/overlay --compile Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /Library/Python/2.7/site-packages/pip-19.2.3-py2.7.egg/pip install --ignore-installed --no-user --prefix /private/var/folders/mh/szrw8j2x4x9b73d8jmv1vb0m0000gn/T/pip-build-env-KEQPtW/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
经检查核心错误信息为:No package 'cairo' found
经查找到了cairo的官网,在这里了解如何安装cairo模块,MacOS下安装有3中方式
第一种是MacPorts工具,根据连接下载对应系统版本的安装包,下载下来是pkg文件,直接双击安装即可
根据官网提示,在安装前需要先安装xcode,并执行 sudo xcode-select --install 和 sudo xcodebuild -license
安装时间较久,耐心等待。。。
安装完成后,就可以使用sudo port install cairo了
再次执行pip install AppKit, 完美!