python - 由于 ssl 错误,无法在 python 3.6 中 pip 安装包

标签 python ssl

我正在远程服务器上工作。当我尝试在虚拟环境中使用 pip 安装任何东西时,出现错误:

(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 权限)还是需要联系管理员?

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

我考虑过更改 setup.py 并在我家重新安装,正如 Claudio 在这里所建议的:

pip3 installs inside virtual environment with python3.6 failing due to ssl module not available

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

最佳答案

听起来您是在没有 libssl-dev 的情况下从源代码构建 python。

运行:

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

关于python - 由于 ssl 错误,无法在 python 3.6 中 pip 安装包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43923085/

相关文章:

通过 SSL 提供服务时,Wordpress CSS 在 Chrome 中中断

c# - 在 DMZ 中进行 WCF 用户名/密码身份验证的推荐方法是什么

ssl - 同一站点的两个独立域上的重定向问题

python - PyQt4 无法创建简单的 GUI 应用程序

python - 使单元格适合文本(并使其只读)

python - fft 的输出表示为正弦/余弦形式的傅里叶级数

amazon-web-services - 通过 AWS ELB 的 MongooseIM SSL 连接

java - Wildfly 的 JAXWS 实现似乎忽略了 bindingProvider 属性 com.sun.xml.ws.transport.https.client.SSLSocketFactory

python - 无法使用 ace-builds 设置 themePath

python - 合并 python 集合字典