由于 ssl 错误,无法在 python 3.6 中 pip 安装包 [英] Can't pip install packages in python 3.6 due to ssl error

查看:44
本文介绍了由于 ssl 错误,无法在 python 3.6 中 pip 安装包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在远程服务器上工作.当我尝试在我的虚拟环境中使用 pip 安装任何东西时,我收到一个错误:

I'm working on a remote server. When I try to install anything with pip within my virtual environment I get an error:

(venv) [barta@bivoj program]$ pip install -r requirements.txt 
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting joblib==0.11 (from -r requirements.txt (line 1))
  Could not fetch URL https://pypi.python.org/simple/joblib/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping

python 2.7 一切正常.我可以自己解决这个问题吗(我没有root权限)还是需要联系管理员?

Everything is working fine with python 2.7. Can I solve this problem by myself (I don't have root access) or do I need to contact the administrator?

首先,当我在主文件夹中安装 python 3.6 时遇到了这个问题.我认为问题可能是因为它在我的主文件夹中,所以我要求全新安装 python 3.6.

First I had this problem when I installed python 3.6 in my home folder. I figured that the problem might be because it's in my home folder, so I asked for a clean install of python 3.6.

我考虑过更改 setup.py 并在我家中再次安装,正如 Claudio 在这里建议的那样:

I considered changing the setup.py and install again in my home, as suggested here by Claudio:

pip3 安装在里面由于 ssl 模块不可用,python3.6 的虚拟环境失败

但我没有找到任何 openssl 文件夹./usr/bin 中有 openssl,但这不是目录.我搜索了 ssl.h 文件,但在任何地方都没有找到.

but I didn't find any openssl folder. There is openssl in /usr/bin, but that is not a directory. I searched for the ssl.h file, but did not find it anywhere.

推荐答案

听起来你已经从源代码构建了 python,而没有 libssl-dev 存在.

Sounds like you've built python from source without libssl-dev present.

运行:

sudo apt-get install libssl-dev
sudo ./configure
sudo make altinstall

这篇关于由于 ssl 错误,无法在 python 3.6 中 pip 安装包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆