我正在使用Python 3.6。当我尝试使用pip3
安装“模块”时,我遇到了这个问题:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
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
...
安装完3.8.5之后,问题得到了解决。证书验证和OpenSSL
该软件包包含自己的 OpenSSL 1.1.1 私有副本。由 Keychain Access 应用程序和 security 命令行实用程序管理的系统和用户密钥链中的信任证书不是 Python ssl 模块的默认值。
我遇到了这个问题!我不小心安装了32位的Miniconda3版本。请确保选择64位的版本!
yum install python36-pyOpenSSL
Python的版本和包管理器可能会有所不同。
您可以尝试使用Anaconda提示符。
您会看到(base), 现在升级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 库。继续前进
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pb-tool/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pb-tool/
ERROR: Operation cancelled by user
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
conda install anaconda-navigator
在这篇文章中提到了:pip被配置为需要TLS/SSL的位置,但Python中的ssl模块不可用
brew link
命令,它会显示正确的指令:$ 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"
在尝试自己编译Python并仍然缺少ssl模块后,我最终尝试了从apt安装缺失的模块,方法如下:
apt install python3-openssl
libssl-dev
或者通过pip安装sslpip install ssl
https://dev59.com/3FgR5IYBdhLWcg3woebW - ZiTAL