今天使用pip安装一个requirements.txt列表的时候,碰到一个错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
creating build/temp.macosx-10.12-intel-2.7/build creating build/temp.macosx-10.12-intel-2.7/build/temp.macosx-10.12-intel-2.7 cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prot otypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2 .7/include/python2.7 -c build/temp.macosx-10.12-intel-2.7/_openssl.c -o build/temp.macosx-10.12-intel-2.7/build/temp.macosx-10.12-intel-2.7/_openssl.o build/temp.macosx-10.12-intel-2.7/_openssl.c:434:10: fatal error: 'openssl/opensslv.h' file not found #include <openssl/opensslv.h> ^ 1 error generated. error: command 'cc' failed with exit status 1 ---------------------------------------- Failed building wheel for cryptography Failed to build cryptography Installing collected packages: cryptography, paramiko, pycrypto, ansible, py, pytest, coverage, pytest-cov, pytest-timeout, httmock, funcsigs, pbr, mock, Yorg Running setup.py install for cryptography Complete output from command /Users/laixintao/.virtualenvs/yorg/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/23/4kbs9t712jv1mvmw6cpjwr2m0000gn/T/ pip-build-ureXI4/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/23/ 4kbs9t712jv1mvmw6cpjwr2m0000gn/T/pip-duuUHu-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/laixintao/.virtualenvs/yorg/include/s ite/python2.7/cryptography: running install running build running build_py running egg_info writing requirements to src/cryptography.egg-info/requires.txt writing src/cryptography.egg-info/PKG-INFO writing top-level names to src/cryptography.egg-info/top_level.txt writing dependency_links to src/cryptography.egg-info/dependency_links.txt writing entry points to src/cryptography.egg-info/entry_points.txt reading manifest file 'src/cryptography.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' no previously-included directories found matching 'docs/_build' warning: no previously-included files matching '*' found under directory 'vectors' writing manifest file 'src/cryptography.egg-info/SOURCES.txt' running build_ext generating cffi module 'build/temp.macosx-10.12-intel-2.7/_commoncrypto.c' already up-to-date generating cffi module 'build/temp.macosx-10.12-intel-2.7/_padding.c' already up-to-date generating cffi module 'build/temp.macosx-10.12-intel-2.7/_constant_time.c' already up-to-date generating cffi module 'build/temp.macosx-10.12-intel-2.7/_openssl.c' already up-to-date building '_openssl' extension cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-pr ototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions /2.7/include/python2.7 -c build/temp.macosx-10.12-intel-2.7/_openssl.c -o build/temp.macosx-10.12-intel-2.7/build/temp.macosx-10.12-intel-2.7/_openssl.o build/temp.macosx-10.12-intel-2.7/_openssl.c:434:10: fatal error: 'openssl/opensslv.h' file not found /2.7/include/python2.7 -c build/temp.macosx-10.12-intel-2.7/_openssl.c -o build/temp.macosx-10.12-intel-2.7/build/temp.macosx-10.12-intel-2.7/_openssl.o [98/623] build/temp.macosx-10.12-intel-2.7/_openssl.c:434:10: fatal error: 'openssl/opensslv.h' file not found #include <openssl/opensslv.h> ^ 1 error generated. error: command 'cc' failed with exit status 1 ---------------------------------------- Command "/Users/laixintao/.virtualenvs/yorg/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/23/4kbs9t712jv1mvmw6cpjwr2m0000gn/T/pip-build-ureXI4/cryptog raphy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/23/4kbs9t712jv1mvmw6cpjwr2m 0000gn/T/pip-duuUHu-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/laixintao/.virtualenvs/yorg/include/site/python2.7/cryptograp hy" failed with error code 1 in /private/var/folders/23/4kbs9t712jv1mvmw6cpjwr2m0000gn/T/pip-build-ureXI4/cryptography |
问题是出在了“cryptograp”,网上查了一下,有人说安装一下xcode的命令行工具就好了:
1 |
xcode-select --install |
但是我执行这个命令的时候,说是已经安装了。
又在另一个地方查到,使用下面这个命令安装,居然成功了。
1 2 |
ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" \ CFLAGS="-I/usr/local/opt/openssl/include" pip install xxxx |
所以 是什么问题…
应该就是哪个编译选项的问题吧,具体要看这个加密的库依赖了啥了。这篇博客挺水的…