MacOS10.14 python2.7安裝AppKit包的問題

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, 完美!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章