使用pip命令出现了问题,提示说找不到ssl模块,出现错误如下:
pip is configured with locations that require TLS/SSL, however the ssl module in
Python is not available.
Could not fetch URL https:*******: There was a problem confirming the ssl certificate:
Can't connect to HTTPS URL because the SSL module is not available. - skipping
解决方法:
- 第一步:首先确定你已经安装过OpenSSL,没有安装过可以使用以下指令安装
brew install OpenSSL
- 第二步link你的openssl,链接的过程终端可能有如下打印,详情请看下图
brew unlink openssl && brew link openssl --force
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
在终端上执行:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
在~/.bash_profile中添加下面两条内容
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
执行完上述操作后,我的bash_profile文件如下截图:

3.第三步就是使你的bash_profile生效,再次尝试安装
source ~/.bash_profile
网友评论