我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

当前回答

我简单地用以下命令解决了这个问题:

Brew升级python@3.9

这个版本默认包含SSL !

其他回答

此问题是由于您的PC上缺少OpenSSL包。

如果pip install openpyxl也给出错误。

你可以通过以下站点安装OpenSSL(Win64 OpenSSL v1.1.1g)来解决这个问题:

slproweb.com/products/Win32OpenSSL.html

重新启动您正在使用的IDE,使更改生效。

为我工作。

pkg install openssl

使用此选项可以启用ssl。

你可以尝试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"

我简单地用以下命令解决了这个问题:

Brew升级python@3.9

这个版本默认包含SSL !

你可以去蟒蛇餐厅试试。

你会看到(基础),现在升级pip。 例子:

(base) C:\Users\Tom>cd ..

(base) C:\Users>cd ..

(base) C:\>python -m pip install --upgrade pip
Requirement already up-to-date: pip in g:\anaconda3\lib\site-packages (20.0.2)

(base) C:\>pip -V
pip 20.0.2 from G:\Anaconda3\lib\site-packages\pip (python 3.7)

# Try install
(base) C:\>pip install selenium

这将花费较长的时间,但也将安装或升级Anaconda内部使用的SSL库。继续前进