OSX El Capitan python安装加密失败

我试过了

sudo pip安装密码

并且错误信息是

收集加密使用缓存加密-1.3.2-cp27-none-macosx_10_6_intel.whl需求已经满足(使用 - 升级升级):cffi> = 1.4.1 /Library/Python/2.7/site-packages(来自加密技术)需求已满足(使用 - 升级升级):pyasn1> = 0.1.8 in /Library/Python/2.7/site-packages(来自加密)收集setuptools> = 11.3(来自加密)使用缓存的setuptools-21.0.0- py2.py3-none-any.whl需求已经满足(使用 - 升级升级):six> = 1.4.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python(from密码学)需求已满足(使用 - 升级升级):idna> = 2.0 in /Library/Python/2.7/site-packages(来自加密)需求已满足(使用 - 升级升级):ipaddress in / Library / Python / 2.7 / site-packages(来自密码学)需求已经满足(使用--upgrade升级):/Library/Python/2.7/site-packages中的enum34(来自加密)需求alrea dy满意(使用--upgrade升级):pycparser在/Library/Python/2.7/site-packages(从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 status = self.run(options, args)在运行prefix = options.prefix_path,File“/Library/Python/2.7/site-packages/pip/ req / req_set.py“,第736行,在安装中要求.uninstall(auto_confirm = True)文件”/Library/Python/2.7/site-packages/pip/req/req_install.py“,第742行,在卸载paths_to_remove.remove (auto_confirm)文件“/Library/Python/2.7/site-packages/pip/req/req_uninstall.py”,第115行,删除重命名(路径,new_path)文件“/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行,移动copytree(src,real_dst,symlinks = True)文件”/ System / Library / Frameworks / Python“。框架/版本/ 2.7 / lib / python2.7 / shutil.py“,第208行,在copytree raise错误,错误错误:[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/蟒/ _markerlib / 初始化的.py”, '/tmp/pip-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化的.py',“[错误1 ]操作不允许: '/tmp/pip-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化的.py“'),('/系统/图书馆/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化 .pyc文件'' /tmp/pip-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/ lib / python / _markerlib / init .pyc',“[Errno 1] Operation not permitted:'/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/markers.py','/ tmp / pip-p7Ywro-uninstall / System / Library / Frameworks / Python.framework / Versions / 2.7 / Extras / lib / python / _markerlib /marks.py',“[Errno 1] Operation not permitted:'/ 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] Operation not permitted:'/tmp/pip-p7Ywro-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib “”)]

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

brew安装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'文件未找到#include生成^ 1错误。 错误:命令'cc'失败,退出状态为1


命令“/ usr / bin / python -u -c”导入setuptools,tokenize; 文件 ='/ private / tmp / pip-build-MxT6op / cryptography / setup.py'; exec(compile(getattr(tokenize,'open',open)( file ).read().export(' r n ',' n'), file ,'exec'))“install --record /tmp/pip-G6b8Y_-record/install-record.txt --single-version-external-managed -compile”失败,出错代码1在/ private / tmp / pip-build-MxT6op / cryptography /

我也试过了

brew安装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 status = self.run(options,args)文件“/Library/Python/2.7/site-packages/pip/commands/install.py”,第317行,在运行prefix = options.prefix_path,File“/ Library / Python / 2.7 / site-packages / pip / req / req_set.py“,第736行,在安装中要求.uninstall(auto_confirm = True)文件”/Library/Python/2.7/site-packages/pip/req/req_install.py“,第742行,卸载paths_to_remove.remove(auto_confirm)文件“/Library/Python/2.7/site-packages/pip/req/req_uninstall.py”,第115行,删除重命名(path,new_path)文件“/ Library / Python /2.7/site-packages/pip/utils/ 初始化的.py “线路267,在重命名shutil.move(旧,新)文件” /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2。 7 / shutil.py“,第299行,移动copytree(src,real_dst,symlinks = True)文件”/System/Library/Frameworks/Python.fram ework / Versions / 2.7 / lib / python2.7 / shutil.py“,第208行,在copytree raise中错误,错误错误:[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/蟒/ _markerlib / 初始化的.py”, '/tmp/pip-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化的.py',“[错误1 ]操作不允许: '/tmp/pip-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化的.py“'),('/系统/图书馆/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/ 初始化 .pyc文件'' /tmp/pip-aYpqDT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/ lib / python / _markerlib / init .pyc',“[Errno 1] Operation not permitted:'/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/markers.py','/ tmp / pip-aYpqDT-uninstall / Sy 干/库/框架/ Python.framework /版本/ 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] Operation not permitted '','/ 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/_markerl IB'“)]

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


对我有效的是:

sudo brew reinstall python

我通过以下命令获得了此修复程序:

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

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

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

链接地址: http://www.djcxy.com/p/72011.html

上一篇: OSX El Capitan python install cryptography fail

下一篇: How to install packages in different version of python?