解决cmd中无法访问huggingface.co的问题

文章讲述了如何在命令行中设置http和https代理,遇到错误后通过安装httpx[socks]、设置proxy参数以及切换到http协议来解决问题的过程。
摘要由CSDN通过智能技术生成

命令行走代理

set http_proxy=socks5://127.0.0.1:7890
set https_proxy=socks5://127.0.0.1:7890

移除环境变量

set all_proxy=
set ALL_PROXY=

端口号
然报错:

ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.

遂安装依赖项

pip install httpx[socks]

继续报错

ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support.

使用代理服务器:
如果在安装过程中遇到了网络限制,可以考虑使用代理服务器。在安装时,确保代理服务器的配置适用于你的系统。你可以使用 --proxy 参数指定代理服务器,例如:

Copy code
pip install --proxy=http://代理服务器地址:端口 pysocks

将上述命令中的 代理服务器地址 替换为代理服务器的实际地址,端口 替换为代理服务器的端口号。

一波操作后还是无法访问
(这里可以用curl命令来查看时候通了)

curl google.com
curl: (52) Empty reply from server
curl baidu.com
<html>
<meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
</html>

显然没通
然后

set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890

curl通了,原来走的是http协议,不是socket5协议

解决问题过程中参考的资料:
https://zhuanlan.zhihu.com/p/46973701

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值