我使用的是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"
其他回答
操作系统一样,pyenv
如果你的python是pyenv安装的,其中pyenv是在macOS上安装的,可能有一个更新的版本可以修复这个问题:
$ brew update && brew upgrade pyenv
然后重新安装python版本:
$ pyenv install 3.7.2
pyenv: /Users/luckydonald/.pyenv/versions/3.7.2 already exists
continue with installation? (y/N)
注意,像这样覆盖现有的python安装有点脏,但在我的例子中,它确实有效。可能更干净的方法是删除它,然后正确地重新创建。
我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!
与上述解决方案类似,使用pyenv重新安装python版本。
不知何故,我升级了我的openssl,它破坏了pyenv版本的python。
pyenv install 3.6.8
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
...
第一行说它依赖于自制的openssl。
Windows 10, Windows 7 如果pip install在CMD提示符下不工作,使用Anaconda提示符运行它-它工作。
https://github.com/pypa/virtualenv/issues/1139
修复此问题,无需更改任何与TSL/SSL相关的内容。
我试着看看同样的事情是否发生在皮普身上,看到皮普被打破了。我做了一些调查,发现这可能是由于Homebrew在2020年2月1日删除了python@2造成的。
运行brew uninstall python@2,删除Homebrew安装的python2。
销毁了使用python3创建的虚拟环境,并创建了一个新的。Pip3安装工作再次正常。