Python 无法安装pyOpenSSL
我在Macbook Pro上双重启动了Windows 10分区: Mac:El Capitan(64位) Windows:Windows 10 64位,使用fat文件系统格式化 在Windows上,我安装了cygwin和Python 2.7。通过cygwin,我安装了pip和gcc 我还尝试使用安装cffi,但当我运行pip安装Python 无法安装pyOpenSSL,python,windows,python-2.7,windows-10,pyopenssl,Python,Windows,Python 2.7,Windows 10,Pyopenssl,我在Macbook Pro上双重启动了Windows 10分区: Mac:El Capitan(64位) Windows:Windows 10 64位,使用fat文件系统格式化 在Windows上,我安装了cygwin和Python 2.7。通过cygwin,我安装了pip和gcc 我还尝试使用安装cffi,但当我运行pip安装cffi-1.8.2-cp27-cp27m-win_amd64.whl,我得到错误:cffi…此平台不支持whl。然后我尝试了很多我不记得的东西,我想我甚至试过下载一个t
cffi-1.8.2-cp27-cp27m-win_amd64.whl
,我得到错误:cffi…此平台不支持whl
。然后我尝试了很多我不记得的东西,我想我甚至试过下载一个tar文件,然后现在,当我运行pip install cffi时,我被告知它已经安装好了
然后我运行了pip安装pyOpenSSL
,但是,我遇到了以下错误:
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/python2.7 -c build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c -o build/temp.cygwin-2.6.0-x86_64-2.7/build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.o
build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c:433:30: fatal error: openssl/opensslv.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9Emw8c/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wy64bj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9Emw8c/cryptography/
我在执行pip安装加密时也遇到了这个错误
我在某个地方读到应该尝试的内容:pip安装--global option build\u ext--global option--compiler=mingw64 pyopenssl
,我得到了:
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Installing collected packages: cryptography, pyopenssl
Running setup.py install for cryptography ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fIb1xc/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" build_ext --compiler=mingw64 install --record /tmp/pip-7flSlN-record/install-record.txt --single-version-externally-managed --compile:
running build_ext
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_padding.c'
creating build
creating build/temp.cygwin-2.6.0-x86_64-2.7
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_constant_time.c'
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c'
error: don't know how to compile C/C++ code on platform 'posix' with 'mingw64' compiler
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fIb1xc/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" build_ext --compiler=mingw64 install --record /tmp/pip-7flSlN-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-fIb1xc/cryptography/
有人能告诉我怎么了吗
更新:通过cygwin安装mingw64x86\u 64-openssl:openssl-encryption library for Win64工具链
,并运行pip-install-pyopenssl
后,我得到:
running build_ext
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_padding.c'
creating build/temp.cygwin-2.6.0-x86_64-2.7
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_constant_time.c'
generating cffi module 'build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c'
building '_openssl' extension
creating build/temp.cygwin-2.6.0-x86_64-2.7/build
creating build/temp.cygwin-2.6.0-x86_64-2.7/build/temp.cygwin-2.6.0-x86_64-2.7
/usr/bin/clang -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/python2.7 -c build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c -o build/temp.cygwin-2.6.0-x86_64-2.7/build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.o
build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c:433:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ZsWN3h/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-D2XH0P-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ZsWN3h/cryptography/
运行build\u ext
生成cffi模块“build/temp.cygwin-2.6.0-x86_64-2.7/_padding.c”
创建构建/临时cygwin-2.6.0-x86_64-2.7
生成cffi模块“build/temp.cygwin-2.6.0-x86\u 64-2.7/\u constant\u time.c”
生成cffi模块“build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c”
正在生成“\u openssl”扩展
创建build/temp.cygwin-2.6.0-x86_64-2.7/build
创建build/temp.cygwin-2.6.0-x86_64-2.7/build/temp.cygwin-2.6.0-x86_64-2.7
/usr/bin/clang-fno严格别名-ggdb-O2-pipe-Wimplicit函数声明-fdebug prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1-fdebug prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/debug/python-2.7.10-1-1-DNDEBUG-RICO3-FWT-墙原型-I/usr/include/python2.7-c build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c-o build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.o
build/temp.cygwin-2.6.0-x86_64-2.7/_openssl.c:433:10:致命错误:未找到“openssl/opensslv.h”文件
#包括
^
生成1个错误。
错误:命令“/usr/bin/clang”失败,退出状态为1
----------------------------------------
命令“/usr/bin/python-u-c”导入setuptools,标记化__文件_='/tmp/pip-build-ZsWN3h/cryptography/setup.py';exec(compile(getattr(tokenize,'open',open)(uuu文件uu).read().replace('\r\n','\n'),uu文件uuu,'exec'))“install--record/tmp/pip-D2XH0P-record/install-record.txt--外部管理的单一版本--compile”失败,错误代码为/tmp/pip-build-ZsWN3h/cryptography中的1/
我遇到了类似的问题,安装了libssl头文件,以便编译python模块:
sudo apt-get install libssl-dev
您是否安装了OpenSSL(因为pyOpenSSL只是围绕它的Python包装器)?是的,我安装了。它位于\cydrive\c\OpenSSL-win64中。我是从源代码处安装的:这条路径看起来像是您已经为Win安装了OpenSSL,最有可能的是您必须安装(或构建,如果不可用)Cygwin版本。作为快速测试运行/cydrive/c/OpenSSL-win64/bin/OpenSSL version-a
并查看其输出内容。它输出:OpenSSL 1.1.0 2016年8月25日,构建于:可复制构建,未指定日期,平台:,编译器:cl“VC-WIN64A,OPENSSLDIR:“c:\Program Files\Common Files\SSL”,ENGINESDIR:“c:\Program File\OpenSSL\lib\engines-1\u 1”
Hmm,好吧,一些需要OpenSSL的工具只是运行它(并从它的输出找出它的路径)或者从${path}获取它,我怀疑/cydrive/c/OpenSSL-win64/bin是否在其中。您能否创建一个符号链接:/usr/bin/openssl
,指向可执行文件,然后再次尝试安装模块?或者有没有办法将OpenSSL安装目录传递给pip?