【问题标题】:Problems in using pip to install tensorflow on iMac El Capitan?在 iMac El Capitan 上使用 pip 安装 tensorflow 的问题?
【发布时间】:2016-11-27 05:31:36
【问题描述】:

我关注了the installation guide,但最后的安装步骤失败了。 我安装的python版本: python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin 我使用了以下两个命令安装tensorflow

  1. sudo pip install --upgrade $TF_BINARY_URL

  2. sudo -H pip install --upgrade $TF_BINARY_UR

不知何故,我发现我的 Python 2.7 下没有安装 Protobuf, 所以我按照安装站点的建议,

  1. pip install protobuf

无法安装 protobuf,请参阅下面的错误消息。

请帮忙

提前致谢

使用第一个命令时,得到以下消息:

The directory '/Users/David/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/David/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

然后按照建议,我使用了第二个命令,然后错误消息是:

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-9CKE1y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

对于命令3,错误信息:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/h5/vh7y894j0js3vqkv_hz4qk6w0000gn/T/pip-build-KWqDAq/protobuf/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/h5/vh7y894j0js3vqkv_hz4qk6w0000gn/T/pip-5RoEnu-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/h5/vh7y894j0js3vqkv_hz4qk6w0000gn/T/pip-build-KWqDAq/protobuf/

【问题讨论】:

    标签: macos python-2.7 installation tensorflow osx-elcapitan


    【解决方案1】:

    我认为这是 El Capitan 中 System Integrity Protection 的结果。我能够使用以下内容进行安装:

    # Note the lack of "sudo" and the addition of "--user"
    pip install --user --upgrade $TF_BINARY_URL
    # And then to ensure that the user-specific packages are used,
    # I had to start python from the user-site packages directory
    cd $(python -m site --user-site)
    

    【讨论】:

      【解决方案2】:

      我在安装 awsebcli 时遇到了类似的问题,

      尝试:

      sudo pip install protobuf --ignore-installed six
      

      【讨论】:

        猜你喜欢
        • 2019-01-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-19
        • 2016-03-11
        • 1970-01-01
        • 2018-06-19
        • 1970-01-01
        相关资源
        最近更新 更多