搞了一上午了,网上搜了很多方法都没解决。关掉代理,设置代理,python 卸载重装等也不行。头痛欲裂。
$ pip install requests
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
WARNING: There was an error checking the latest version of pip.
python 和 pip 都是最新版
$ python -V
Python 3.11.3
$ pip -V
pip 22.3.1 from D:\python-3.11\Lib\site-packages\pip (python 3.11)
1
aru 2023-04-17 12:05:10 +08:00
你改了 pip 的镜像配置么?
先试试下面命令能不能安装 pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple requests 如果可以,再执行下面命令 pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple |
2
raymanr 2023-04-17 12:05:34 +08:00
换个源试试行不行 pip install -i https://pypi.douban.com/simple requests
|
3
qwq11 2023-04-17 12:07:58 +08:00
Cannot connect to proxy 说你代理的问题吧,检查检查代理地址写对了吗,telnet/curl 试试呢。关掉代理不可能也是这个问题吧。你也可以 -i 走国内 pypi 的镜像
|
4
iosyyy 2023-04-17 12:10:46 +08:00
你代理没有启动或者代理配置的有问题
|
5
taogen OP @aru @raymanr 开着 v2ray 代理指定了源还是 ProxyError ,关掉代理变成了 ProtocolError 。
$ pip install -i https://pypi.douban.com/simple requests Looking in indexes: https://pypi.douban.com/simple WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/ ERROR: Could not find a version that satisfies the requirement requests (from versions: none) ERROR: No matching distribution found for requests WARNING: There was an error checking the latest version of pip. |
6
Yourshell 2023-04-17 12:15:59 +08:00
要不你先试一下在命令行下你的代理是否工作?
|
7
taogen OP 命令行设置代理 export ALL_PROXY=socks5://127.0.0.1:1080 后可以访问 google 了
$ curl -s https://google.com <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="https://www.google.com/">here</A>. </BODY></HTML> 现在的错误是 OSError: Missing dependencies for SOCKS support. $ pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple requests Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support. $ pip install requests ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support. |
9
taogen OP OSError: Missing dependencies for SOCKS support. 是不是要下载源码安装 urllib3 啊,我之前看网上是这样说的。
$ git clone https://github.com/urllib3/urllib3.git $ cd urllib3 $ pip install . |
10
Yourshell 2023-04-17 12:25:11 +08:00
|
11
NoOneNoBody 2023-04-17 12:25:34 +08:00 1
|
12
raymanr 2023-04-17 12:28:38 +08:00
|
13
taogen OP @raymanr 好像不支持 socks 的代理
$ pip install requests --proxy 'socks://127.0.0.1:1080' ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support. |
14
taogen OP @NoOneNoBody 删除 SSLKEYLOGFILE 变量可以了
$ pip install requests Collecting requests Downloading requests-2.28.2-py3-none-any.whl (62 kB) -------------------------------------- 62.8/62.8 kB 674.1 kB/s eta 0:00:00 Collecting charset-normalizer<4,>=2 Downloading charset_normalizer-3.1.0-cp311-cp311-win_amd64.whl (96 kB) ---------------------------------------- 96.7/96.7 kB 1.4 MB/s eta 0:00:00 Collecting idna<4,>=2.5 Downloading idna-3.4-py3-none-any.whl (61 kB) ---------------------------------------- 61.5/61.5 kB ? eta 0:00:00 Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB) -------------------------------------- 140.9/140.9 kB 4.1 MB/s eta 0:00:00 Collecting certifi>=2017.4.17 Downloading certifi-2022.12.7-py3-none-any.whl (155 kB) -------------------------------------- 155.3/155.3 kB 9.1 MB/s eta 0:00:00 Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests Successfully installed certifi-2022.12.7 charset-normalizer-3.1.0 idna-3.4 requests-2.28.2 urllib3-1.26.15 [notice] A new release of pip available: 22.3.1 -> 23.1 [notice] To update, run: python.exe -m pip install --upgrade pip |
15
digimoon 2023-04-17 13:28:35 +08:00
pip install pysocks
pip install xxxx --proxy socks5://xxxx:1080 |