首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法安装pyOpenSSL

无法安装pyOpenSSL
EN

Stack Overflow用户
提问于 2016-09-16 15:12:26
回答 1查看 2.5K关注 0票数 2

我在Macbook Pro上双重启动了Windows 10分区: Mac: El Capitan (64位) Windows: Windows 10 64位,使用fat文件系统格式化

在Windows上,我安装了cygwin和Python 2.7。通过cygwin,我安装了pip和gcc。

我也尝试过用http://www.lfd.uci.edu/~gohlke/pythonlibs/#cffi安装cffi,但是当我运行pip install cffi-1.8.2-cp27-cp27m-win_amd64.whl时,我得到了错误:cffi....whl is not supported on this platform。然后我尝试了很多我记不起来的东西,我想我甚至尝试过下载tar文件,然后现在,当我运行pip install cffi时,我被告知它已经安装了。

然后我运行了pip install pyOpenSSL,但是,我得到了这个错误:

代码语言:javascript
复制
 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 install cryptography的时候也遇到了这个错误。

我在某个地方读到了我应该尝试一下:pip install --global-option build_ext --global-option --compiler=mingw64 pyopenssl,我得到了:

代码语言:javascript
复制
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_64-openssl: OpenSSL encryption library for Win64 toolchain并运行pip install pyopenssl后,我得到了:

代码语言:javascript
复制
 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/
EN

回答 1

Stack Overflow用户

发布于 2016-10-20 00:28:25

我遇到了类似的问题,并安装了libssl头文件,这样我就可以编译python模块:

代码语言:javascript
复制
sudo apt-get install libssl-dev
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39525704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档