大佬们,求助 pip install 出现 ProxyError 如何解决啊 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
taogen

大佬们,求助 pip install 出现 ProxyError 如何解决啊

  •  
  •   taogen
    tagnja 2023 年 4 月 17 日 4068 次点击
    这是一个创建于 1105 天前的主题,其中的信息可能已经有所发展或是发生改变。

    搞了一上午了,网上搜了很多方法都没解决。关掉代理,设置代理,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 条附言    2023 年 4 月 17 日
    删除 SSLKEYLOGFILE 变量之后可以了。可能之前我把那个变量指向的文件夹删除了
    第 2 条附言    2023 年 4 月 17 日
    十分感谢各位大佬的帮助
    16 条回复    2025-02-24 10:14:12 +08:00
    aru
        1
    aru  
       2023 年 4 月 17 日
    你改了 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
    raymanr
        2
    raymanr  
       2023 年 4 月 17 日
    换个源试试行不行 pip install -i https://pypi.douban.com/simple requests
    shxxy
        3
    shxxy  
       2023 年 4 月 17 日
    Cannot connect to proxy 说你代理的问题吧,检查检查代理地址写对了吗,telnet/curl 试试呢。关掉代理不可能也是这个问题吧。你也可以 -i 走国内 pypi 的镜像
    iosyyy
        4
    iosyyy  
       2023 年 4 月 17 日
    你代理没有启动或者代理配置的有问题
    taogen
        5
    taogen  
    OP
       2023 年 4 月 17 日
    @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.
    Yourshell
        6
    Yourshell  
       2023 年 4 月 17 日
    要不你先试一下在命令行下你的代理是否工作?
    taogen
        7
    taogen  
    OP
       2023 年 4 月 17 日
    命令行设置代理 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=">
    <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.
    taogen
        8
    taogen  
    OP
       2023 年 4 月 17 日
    taogen
        9
    taogen  
    OP
       2023 年 4 月 17 日
    OSError: Missing dependencies for SOCKS support. 是不是要下载源码安装 urllib3 啊,我之前看网上是这样说的。

    $ git clone https://github.com/urllib3/urllib3.git
    $ cd urllib3
    $ pip install .
    Yourshell
        10
    Yourshell  
       2023 年 4 月 17 日
    raymanr
        12
    raymanr  
       2023 年 4 月 17 日
    taogen
        13
    taogen  
    OP
       2023 年 4 月 17 日
    @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.
    taogen
        14
    taogen  
    OP
       2023 年 4 月 17 日   1
    @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
    digimoon
        15
    digimoon  
       2023 年 4 月 17 日
    pip install pysocks
    pip install xxxx --proxy socks5://xxxx:1080
    RyougiShiki
        16
    RyougiShiki  
       2025 年 2 月 24 日
    14 楼正解。我的情况是官方源和国内源可浏览器访问看到包列表,同一局域网的另一台机器可访问。所以一直在排查代理和 ssl 。之前换下国内源就好了,这次由于是由于 ssl 问题排查了一会还是靠 V 站解决了。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2621 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 46ms UTC 10:26 PVG 18:26 LAX 03:26 JFK 06:26
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86