我使用的是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
当前回答
你可以尝试brew链接,它会告诉你正确的说明:
$ brew link openssl --force
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
其他回答
进入Anaconda提示符并输入(如果你有python3。X安装在你的引擎上):
py -m pip install pymysql
我也有同样的问题,这个解决了我的问题。之后,您可以在power shell或任何其他提示符中导入pymysql。
为我工作。
sudo apt-get install libssl-dev
使用此选项为pip启用ssl。 如果有人遇到问题请告诉我。
如果您已经通过scoop安装了anaconda,并且在conda环境中使用pip时遇到此错误,您可以通过…
将这些添加到路径中
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Scripts
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library\bin
通过scoop安装openssl
scoop install openssl
并从..复制以下dll。\anaconda3\Library\bin到..\anaconda3\ dll
引用:
https://stackoverflow.com/a/54897379 https://stackoverflow.com/a/60405693
我简单地用以下命令解决了这个问题:
Brew升级python@3.9
这个版本默认包含SSL !
在尝试自己编译python后,仍然缺乏ssl模块,我最终尝试从apt安装缺少的模块,就像这样:
安装python3-openssl