我使用的是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
当前回答
我用的是macOS,我用过brew,但Vaulstein在他的回答中提到的并没有涵盖我的情况。
我运行以下命令,以确保我当前的python没有通过brew安装
brew list | grep python
python
python@2
brew info python
python@3.8: stable 3.8.3 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
Not installed
...
所以我从https://www.python.org/下载了最新的3.8.5,安装时我看到了以下信息
证书验证和OpenSSL 此包包含自己的私有OpenSSL 1.1.1副本。的 管理的系统和用户密钥链中的信任证书 Python ssl模块不默认使用Keychain Access应用程序和安全命令行实用程序
在安装3.8.5之后,它修复了这个问题。
其他回答
我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!
这招对我很管用:
yum install python36-pyOpenSSL
Python版本和包管理器可能不同。
为我工作。
pkg install openssl
使用此选项可以启用ssl。
对于未来试图解决这个问题的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
Windows 10 如果你想在正常的cmd中使用pip,而不仅仅是在Anaconda提示符中。您需要添加3个环境路径。 比如:
D:\Anaconda3
D:\Anaconda3\Scripts
D:\Anaconda3\Library\bin
大多数人只添加D:\Anaconda3\Scripts