我使用的是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
当前回答
我试着:
python -m pip install --upgrade pip
在那之后,它在Windows 10中工作得很好。
其他回答
在尝试自己编译python后,仍然缺乏ssl模块,我最终尝试从apt安装缺少的模块,就像这样:
安装python3-openssl
我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!
我用的是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之后,它修复了这个问题。
我在Visual Studio Code从VS Code提示安装pylint时遇到了这个问题。 通过打开Anaconda安装目录并运行,我能够克服这个问题
pip install pylint
然后VS Code很高兴,但这并没有解决运行时的问题
& C:/Users/happy/Anaconda3/python.exe -m pip install -U pylint
基本上都给出了相同的错误,所以看起来VS Code无法访问python模块。
注意,VS Code在安装时选择了它看到的第一个python env,屏幕的左下角表示正在使用哪个env。单击该区域可以设置环境。所以即使你在一个环境中运行pip安装,VS Code也可能会看到一个不同的环境。
最好的方法是确保VS代码选择了正确的python环境,并且相同的环境在系统路径中(在系统属性->高级->环境变量下)
在Path变量下,编辑并浏览到你想要VSCode使用并添加到Path的特定Anaconda目录,我需要添加以下内容:
C:\Users\happy\Anaconda3\
C:\Users\happy\Anaconda3\Scripts\
C:\Users\happy\Anaconda3\Library\bin\
C:\Users\happy\Anaconda3\Library\mingw-w64\bin\
您的Anaconda安装目录可能不同。 需要注意的是,Windows直到重新启动终端才使PATH变量生效。在这种情况下,关闭并重新操作VS代码。如果使用终端或PS Shell,则关闭并重新打开并检查路径,以确保它包括在内。
先安装openssl。
如果你在conda环境中遇到这个问题,你可以安装openssl 使用conda install -c anaconda openssl。它为您启用ssl !