简体   繁体   English

在Python 3.7虚拟环境中使用pip时出现错误“ Python中的ssl模块不可用”

[英]Error “ssl module in Python is not available” when using pip in a Python 3.7 virtual environment

In a virtual environment activated in a virtual machine, I can't install any package with pip, since it raises a SSL related error. 在虚拟机中激活的虚拟环境中,我无法使用pip安装任何软件包,因为它会引发与SSL相关的错误。

I'm setting up a virtual environment (with virtualenv) to mimic the the settings of a server that I'm going to work with. 我正在设置一个虚拟环境(使用virtualenv)来模拟将要使用的服务器的设置。 So I installed mannualy (from tar file) a specific version of python (3.7.0) in a Ubuntu 18.04 virtual machine (using VirtualBox). 因此,我(从tar文件中)在Ubuntu 18.04虚拟机(使用VirtualBox)中安装了python的特定版本(3.7.0)。 Once my python version of choice was running I activated a virtual environment. 一旦我选择的python版本运行,我就会激活一个虚拟环境。 The pip version is 18.1. 点子版本是18.1。

The problem comes when I try to install a python package, like: 当我尝试安装python软件包时,就会出现问题,例如:

$ pip install django

It raised this error: 它引发了此错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting django
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/django/
Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django

Neither of the answers that I found after searching helped me. 搜索后找到的答案都对我没有帮助。 Since pip can't install anything, it can't install packages like ssl nor OpenSSL. 由于pip无法安装任何内容,因此无法安装ssl或OpenSSL之类的软件包。 If anyone can help me, I thank a lot in advance. 如果有人可以帮助我,我要多谢。

I wasn't able to install pandas-datareader. 我无法安装pandas-datareader。 I was getting the same error message. 我收到了同样的错误消息。 Then, in the CMD window, I just put the command "activate base" and then ran pip again and it worked. 然后,在CMD窗口中,我只输入了“ activate base”命令,然后再次运行pip即可。 I tried with django before and after the "activate base" and if it didn't work before, it did work after. 我在“激活基础”之前和之后都尝试过使用django,如果它在之前不起作用,那么它在以后会起作用。 I think it's just some environment variables that are not configured properly. 我认为只是某些环境变量配置不正确。 Luckily this will work for you as well. 幸运的是,这也将为您工作。 Have a nice day Rémy Rémy,祝你有美好的一天

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pip3.7 ubuntu 16 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available - pip3.7 ubuntu 16 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available 在 python 虚拟环境中使用 pip 安装 Pandas 时出现“bz2 模块不可用” - 'bz2 is module not available' when installing Pandas with pip in python virtual environment 使用python 3.7创建pipenv虚拟环境时出错 - error when creating a pipenv virtual environment with python 3.7 使用 pip3 安装 package 时出现“Python 中的 ssl 模块不可用” - "ssl module in Python is not available" when installing package with pip3 pip 给出错误“pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用。” 在 mac - pip gives error "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available." in mac Python-创建虚拟环境时不设点 - Python - No pip when creating a virtual environment pip TLS / SSL,但Python中的ssl模块不可用 - pip TLS/SSL, however the ssl module in Python is not available problem Python 3.7-在命令提示符下执行 pip install Jupyter 时出现 SSL 证书错误 - Python 3.7- SSL certificate error when excuting pip install Jupyter on command prompt 在python3.7虚拟环境中安装pysftp时出错 - Error while installing pysftp in a python3.7 virtual environment Python 3.7 anaconda 环境 - 导入 _ssl DLL 加载失败错误 - Python 3.7 anaconda environment - import _ssl DLL load fail error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM