[英]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.