【问题标题】:OSX El Capitan python install cryptography failOSX El Capitan python安装密码失败
【发布时间】:2016-09-14 21:25:03
【问题描述】:

我试过了

sudo pip 安装密码学

错误信息是

收集密码学 使用缓存的 cryptography-1.3.2-cp27-none-macosx_10_6_intel.whl 已满足要求(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 cffi>=1.4.1(来自密码学) 已满足要求(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 pyasn1>=0.1.8(来自密码学) 收集 setuptools>=11.3(来自密码学) 使用缓存的 setuptools-21.0.0-py2.py3-none-any.whl 已满足要求(使用 --upgrade 升级):/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python 中的六个>=1.4.1(来自密码学) 已满足要求(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 idna>=2.0(来自密码学) 已满足要求(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 ipaddress(来自密码学) 已满足要求(使用 --upgrade 升级): /Library/Python/2.7/site-packages 中的 enum34 (来自密码学) 已满足要求(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 pycparser(来自 cffi>=1.4.1->cryptography) 安装收集的包:setuptools、cryptography 找到现有安装:setuptools 1.1.6 卸载 setuptools-1.1.6: 例外: 回溯(最近一次通话最后): 文件“/Library/Python/2.7/site-packages/pip/basecommand.py”,第 215 行,在 main 状态 = self.run(选项,参数) 运行中的文件“/Library/Python/2.7/site-packages/pip/commands/install.py”,第 317 行 前缀=options.prefix_path, 安装中的文件“/Library/Python/2.7/site-packages/pip/req/req_set.py”,第 736 行 要求.卸载(auto_confirm=True) 卸载中的文件“/Library/Python/2.7/site-packages/pip/req/req_install.py”,第 742 行 path_to_remove.remove(auto_confirm) 文件“/Library/Python/2.7/site-packages/pip/req/req_uninstall.py”,第 115 行,删除 重命名(路径,新路径) 重命名文件“/Library/Python/2.7/site-packages/pip/utils/init.py”,第 267 行 shutil.move(旧的,新的) 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”,第 299 行,在移动中 复制树(src,real_dst,符号链接=真) 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”,第 208 行,在 copytree 引发错误,错误 错误:[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', '/tmp/pip-p7Ywro-uninstall/ System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', "[Errno 1] Operation not allowed: '/tmp/pip-p7Ywro -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-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/ Extras/lib/python/_markerlib/init.pyc', "[Errno 1] Operation not allowed: '/tmp/pip-p7Ywro-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/ marker.py', '/tmp/pip-p7Ywro-uninstall /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] 不允许操作:'/tmp/pip-p7Ywro-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-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] 操作不允许:'/tmp/pip-p7Ywro-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-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] 不允许操作:'/tmp/pip-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_mark erlib'")]

然后我搜索了一些帖子并尝试了

brew install pkg-config libffi openssl

警告:pkg-config-0.28 已安装 警告:已经安装了 libffi-3.0.13 警告:openssl-1.0.2d_1 已经安装

CFLAGS="-I/usr/local/opt/openssl/include" sudo pip install cryptography==0.8

我收到此错误消息:

src/cryptography/hazmat/bindings/pycache/_Cryptography_cffi_f3e4673fx399b1113.c:217:10:致命错误:找不到“openssl/aes.h”文件 #包括 ^ 产生 1 个错误。 错误:命令“cc”失败,退出状态为 1


Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-MxT6op/cryptography/setup.py';exec (compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-G6b8Y_-record/install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 /private/tmp/ pip-build-MxT6op/密码学/

我也试过

brew install pkg-config libffi openssl

env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

得到了这个

找到现有安装:setuptools 1.1.6 卸载 setuptools-1.1.6: 例外: 回溯(最近一次通话最后): 文件“/Library/Python/2.7/site-packages/pip/basecommand.py”,第 215 行,在 main 状态 = self.run(选项,参数) 运行中的文件“/Library/Python/2.7/site-packages/pip/commands/install.py”,第 317 行 前缀=options.prefix_path, 安装中的文件“/Library/Python/2.7/site-packages/pip/req/req_set.py”,第 736 行 要求.卸载(auto_confirm=True) 卸载中的文件“/Library/Python/2.7/site-packages/pip/req/req_install.py”,第 742 行 path_to_remove.remove(auto_confirm) 文件“/Library/Python/2.7/site-packages/pip/req/req_uninstall.py”,第 115 行,删除 重命名(路径,新路径) 重命名文件“/Library/Python/2.7/site-packages/pip/utils/init.py”,第 267 行 shutil.move(旧的,新的) 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”,第 299 行,在移动中 复制树(src,real_dst,符号链接=真) 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”,第 208 行,在 copytree 引发错误,错误 错误:[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', '/tmp/pip-aYpqDT-uninstall/ System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', "[Errno 1] 不允许操作:'/tmp/pip-aYpqDT -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-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/ Extras/lib/python/_markerlib/init.pyc', "[Errno 1] 不允许操作:'/tmp/pip-aYpqDT-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/ marker.py', '/tmp/pip-aYpqDT-卸载/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] 不允许操作:'/tmp/pip-aYpqDT-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-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] 操作不允许:'/tmp/pip-aYpqDT-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-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', “[Errno 1] 不允许操作:'/tmp/pip-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_mark erlib'")]

请帮我解决这个问题。非常感谢。

【问题讨论】:

    标签: python macos


    【解决方案1】:

    对我有用的是:

    sudo brew reinstall python
    

    【讨论】:

    • 我也帮助了我,虽然我在没有sudo 的情况下运行brew
    【解决方案2】:

    我通过以下命令得到了这个修复:

    brew reinstall python
    
    ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" \
    CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography
    
    brew link —force openssl
    

    【讨论】:

      【解决方案3】:

      在 Mac OS El Capitan 上安装加密包。如 Cryptography 安装文档中所述

      env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

      【讨论】:

        猜你喜欢
        • 2016-02-16
        • 2017-01-14
        • 1970-01-01
        • 2016-01-06
        • 1970-01-01
        • 1970-01-01
        • 2016-02-02
        • 1970-01-01
        • 2016-05-08
        相关资源
        最近更新 更多