我使用的是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
当前回答
在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。
其他回答
与上述解决方案类似,使用pyenv重新安装python版本。
不知何故,我升级了我的openssl,它破坏了pyenv版本的python。
pyenv install 3.6.8
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
...
第一行说它依赖于自制的openssl。
对于未来试图解决这个问题的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
如果有人使用Arch Linux操作系统,我通过运行这个解决了TLS/SSL问题:
sudo pacman -S openssl
然后我可以使用pip来安装我需要的包:
pip install openpyxl
此问题是由于您的PC上缺少OpenSSL包。
如果pip install openpyxl也给出错误。
你可以通过以下站点安装OpenSSL(Win64 OpenSSL v1.1.1g)来解决这个问题:
slproweb.com/products/Win32OpenSSL.html
重新启动您正在使用的IDE,使更改生效。
我使用的是Windows 10,安装了Miniconda 3和Python 3.7。
我通过以下https://github.com/conda/conda/issues/8273解决了这个错误
具体来说,我将以下文件从C:\Users\MyUser\Miniconda3\ library \bin复制到C:\Users\MyUser\Miniconda3\ dll:
libcrypto-1_1-x64.dll libcrypto-1_1-x64.pdb libssl-1_1-x64.dll libssl-1_1-x64.pdb