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

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

当前回答

我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!

其他回答

我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!

对于未来试图解决这个问题的Oracle Linux用户,下面是对我有用的方法。 首先安装缺少的库:

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel 
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

然后cd到Python3。X库并运行:

make
make install 

为我工作。

sudo apt-get install libssl-dev

使用此选项为pip启用ssl。 如果有人遇到问题请告诉我。

苹果操作系统

我在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

为我工作。

pkg install openssl

使用此选项可以启用ssl。