我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
当前回答
为我工作。
pkg install openssl
使用此选项可以启用ssl。
其他回答
在ubuntu上从源代码安装python 3.8时遇到了这个问题。下面总结了成功安装默认python 3.7所需的步骤:
sudo apt -y install libssl-dev zlib1g-dev build-essential
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -xf Python-3.8.0.tgz
cd Python-3.8.0/
./configure --enable-optimizations
make
sudo make altinstall
zlib1g-dev和build-essential的安装说明是多余的,因为ubuntu桌面已经有了这些,但对于Amazon的一些EC2实例来说是必要的。Python 3.8.0是目前的最新版本,但应该被最新的可用版本所取代。
这些指令最适合将python 3.7作为python3的默认值,并在虚拟环境中运行python 3.8。
对于未来试图解决这个问题的Oracle Linux用户,下面是对我有用的方法。 首先安装缺少的库:
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
然后cd到Python3。X库并运行:
make
make install
问题可能来自您安装的openssl包版本。这就是我的情况,我解决了这个问题,只是升级它。我在Mac OS上,使用brew:
brew upgrade openssl
如果你用brew安装了python,这应该会直接修复这个问题,因为python依赖于openssl
Windows 10 如果你想在正常的cmd中使用pip,而不仅仅是在Anaconda提示符中。您需要添加3个环境路径。 比如:
D:\Anaconda3
D:\Anaconda3\Scripts
D:\Anaconda3\Library\bin
大多数人只添加D:\Anaconda3\Scripts
修复此问题,无需更改任何与TSL/SSL相关的内容。
我试着看看同样的事情是否发生在皮普身上,看到皮普被打破了。我做了一些调查,发现这可能是由于Homebrew在2020年2月1日删除了python@2造成的。
运行brew uninstall python@2,删除Homebrew安装的python2。
销毁了使用python3创建的虚拟环境,并创建了一个新的。Pip3安装工作再次正常。