我使用的是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
当前回答
我使用的是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
其他回答
此问题是由于您的PC上缺少OpenSSL包。
如果pip install openpyxl也给出错误。
你可以通过以下站点安装OpenSSL(Win64 OpenSSL v1.1.1g)来解决这个问题:
slproweb.com/products/Win32OpenSSL.html
重新启动您正在使用的IDE,使更改生效。
我试着:
python -m pip install --upgrade pip
在那之后,它在Windows 10中工作得很好。
进入Anaconda提示符并输入(如果你有python3。X安装在你的引擎上):
py -m pip install pymysql
我也有同样的问题,这个解决了我的问题。之后,您可以在power shell或任何其他提示符中导入pymysql。
对于Windows 10下的Miniconda3, python=3.7.5,我尝试了以上所有建议;毫无效果。我不得不降级到python=3.7.0,这解决了这个问题
conda install python=3.7.0
显然这很混乱。答案表明升级到3.8.5也可以工作,但这在我的环境中有太多的副作用。
苹果操作系统
我在Mac OS(Mojave)上遇到了同样的问题,并解决了这个链接中提到的问题- Openssl问题。
如果你没有Homebrew或不知道什么是Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
或者如果你已经安装了Homebrew:
brew update && brew upgrade
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
更新: 请记住,我必须使用——ignore-dependencies标记,因为安装的其他包依赖于OpenSSL。
另外,如果问题是在使用pyenv后引起的,您可以通过使用以下方法修复:
brew reinstall python