由于某些与SSL相关的原因,pip3无法安装任何东西。

4

在升级我的Ubuntu服务器16.04后,我无法使用pip3为我的Python3.6安装模块。当我尝试为Python3安装tensorflow-gpu时,我得到了以下错误信息:

root@amax:~# pip3 install tensorflow-gpu
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting tensorflow-gpu
  Could not fetch URL https://pypi.python.org/simple/tensorflow-gpu/: 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 tensorflow-gpu (from versions: )
No matching distribution found for tensorflow-gpu

这是我的Python3和pip3版本:

root@amax:~# python3 -V
Python 3.6.1
root@amax:~# which python3
/usr/local/bin/python3
root@amax:~# pip3 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)

我确定在我的服务器上已安装了openssl:

root@amax:~# apt -y install openssl libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version (1.0.2g-1ubuntu13).
openssl is already the newest version (1.0.2g-1ubuntu13).

我认为问题的原因可能是我的pip3版本与openssl版本不匹配。我该怎么做?任何建议都将不胜感激!谢谢!


1
可能是重复的问题:pip 无法确认 SSL 证书:SSL 模块不可用 - phd
我已经尝试了页面上的所有解决方案,但都没有帮助。 - mlpy
1
安装SSL库后,您必须重新安装Python,因为Python的ssl模块将根据库的存在与否进行安装。使用python -c“import ssl”验证Python的ssl模块。 - phd
1个回答

2

你可以下载一个.whl文件,然后使用pip3进行安装。

这个wheel文件可以在这里找到。

然后只需使用以下命令进行安装:

pip3 install /home/Downloads/tensorflow-1.4.0-cp36-cp36m-manylinux1_x86_64.whl

希望这能解决你的问题。
祝好!

非常感谢!我相信这会有所帮助,但是我已经使用wget和pip3半个小时来处理依赖问题了。我手动安装了bleach、enum34、numpy、protobuf、six、Werkzeug、wheel等等,但tensorflow-gpu仍然需要额外的包。而且我不知道是否能在两个小时内完成这个过程,因为tensorflow-gpu依赖于太多的包。所以有没有一种更方便的方法来处理这个过程呢?谢谢! - mlpy
你在使用什么系统,Windows 还是 Linux? - WiLL_K
我的服务器是Ubuntu 16.04。 - mlpy
1
请查看以下网站,并尝试从头开始安装:这里 - WiLL_K
只需根据您的要求更改版本号。我曾经设置了一些脚本来帮助一个朋友,但目前找不到它。 - WiLL_K

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接