美文网首页
python3: the ssl module in Pytho

python3: the ssl module in Pytho

作者: 747071ac3c1d | 来源:发表于2018-12-13 16:04 被阅读59次
使用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

解决方法:

  1. 第一步:首先确定你已经安装过OpenSSL,没有安装过可以使用以下指令安装

brew install OpenSSL

  1. 第二步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文件如下截图:

1.png

3.第三步就是使你的bash_profile生效,再次尝试安装

source ~/.bash_profile

相关文章

网友评论

      本文标题:python3: the ssl module in Pytho

      本文链接:https://www.haomeiwen.com/subject/sqkbhqtx.html