相关疑难解决方法(0)

使用pip3安装软件包时,"Python中的SSL模块不可用"

我已成功在本地计算机上安装Python 3.4和Python 3.6,但无法安装包pip3.

执行时pip3 install <package>,我收到以下与SSL相关的错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting <package>
  Could not fetch URL https://pypi.python.org/simple/<package>/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement <package> (from versions: )
No matching distribution found for <package>
Run Code Online (Sandbox Code Playgroud)

如何修复我的Python3.x安装,以便我可以安装包pip install …

python ssl pip

75
推荐指数
16
解决办法
15万
查看次数

在非标准位置使用SSL支持构建Python

我需要在RHEL上安装几个Python模块,我没有root访问权限.至少有一个模块也需要访问Python.h.

在这种情况下,我发现最好的方法是安装python及其依赖项~/local.它通常只是工作,但这次Python无法构建SSL模块(请参阅下面的详细信息).这是我正在做的事情的痕迹.

所以我下载了python 6源码然后关闭了我:

./configure --prefix=/home/fds/rms/local
make >& make.log
Run Code Online (Sandbox Code Playgroud)

对日志的检查显示ssl模块尚未编译,但没有提及原因(make或configure中没有其他ssl出现):

Failed to find the necessary bits to build these modules:
_bsddb             _curses            _curses_panel
_hashlib           _sqlite3           _ssl   <----------
Run Code Online (Sandbox Code Playgroud)

所以我想,python根本找不到任何ssl库(这很奇怪,但是嘿......).所以我下载openssl-0.9.8r和

./config --prefix=/home/fds/rms/local shared
make
make install
Run Code Online (Sandbox Code Playgroud)

现在回到Python,我./configure并重新制作.它失败了,但这一次有所不同:

Failed to build these modules:
_hashlib           _ssl
Run Code Online (Sandbox Code Playgroud)

仔细检查日志文件可以发现:

gcc -pthread -shared build/temp.linux-x86_64-2.6/home/fds/rms/installers/Python-2.6.6/Modules/_ssl.o -L/home/fds/rms/local/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.6/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: libssl.so.0.9.8: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

所以现在它正在拿起图书馆,但不是很正确(文件应该在哪里):

$ find /home/fds/rms/local …
Run Code Online (Sandbox Code Playgroud)

python openssl compilation

56
推荐指数
4
解决办法
7万
查看次数

构建Python 3.7.1 - SSL模块失败

从源代码构建Python 3.7会遇到以下错误:

Failed to build these modules:
_hashlib              _ssl                                     

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
Run Code Online (Sandbox Code Playgroud)

我从其他stackoverflow问题尝试了很多变通方法,但它不起作用.我从源代码构建最新的OpenSSL和LibreSSL.OpenSSL路径是:"/ usr/local/ssl",版本为OpenSSL 1.0.2p.

./configure --with-openssl=/usr/local/ssl/
(./configure CPPFLAGS="-I/usr/local/ssl/include" LDFLAGS="-L/usr/local/ssl/lib")
make 
make altinstall
Run Code Online (Sandbox Code Playgroud)

我的系统:Ubuntu 12.04.5 LTS

有任何想法吗?

python ssl openssl python-3.x

11
推荐指数
4
解决办法
5458
查看次数

标签 统计

python ×3

openssl ×2

ssl ×2

compilation ×1

pip ×1

python-3.x ×1