[mac pip错误]Can‘t connect to HTTPS URL because the SSL module is not available

写前面的话

最近,折腾macbook关于python3安装一些软件包,被整的够呛。因为之前安装过py3环境,所以直接想pip 安装需要的依赖包,结果一上来就报错了!

Can't connect to HTTPS URL because the SSL module is not available.

Brew安装

需要安装brew工具

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

但是结果不是很理想,安装百分之20左右就报错了。
大致是这样:

error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

出现这个错误的原因是项目太久,tag资源文件太大

解决方式: 命令终端输入

git config --global http.postBuffer 524288000 

幸运的事,终于可以下载了,但是又产生问题了:

Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Library/Taps/homebrew/homebrew-core --config core.autocrlf=false --depth=1 -q
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q

这是啥情况,百度之好像是没权限,解决方法如下:

sudo chown -R apple:staff

⚠️设备当前名称 不然会报:

chown: apple: illegal user name

最后添加环境变量:

sudo vim .bash_profile
添加
export PATH=/usr/local/bin:$PATH
保存,source .bash_profile使配置修改生效。
重新启动终端  

重新配置python环境

删除旧python环境:

open /System/Library/Frameworks/Python.framework/Versions
删除不需要的python版本

重新进行安装

brew install python3
最后生成的python3 在/usr/local/bin下

pip 下载超时错误

pip._vendor.urllib3.exceptions.ReadTimeoutError HTTPSConnectionPool(host='files.pythonhosted.org', , port=443): Read timed out.

解决办法:
pip install --default-timeout=1000 --upgrade pip

最后的建议

使用该指进行安装:
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=1000

参考

  1. mac下安装配置python3.7
  2. 安装homebrew 失败的解决方案
  3. Mac下安装配置Python2和Python3并相互切换使用
  4. Mac上安装homebrew的心酸历程
  5. Mac OX 安装Homebrew及相关错误解决
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tiny丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值