pip install requests成功安装requests,但pycharm python interpreter关联不到对应的requests包

已经通过命令行pip install requests成功安装requests,但python interpreter关联不到对应的requests包。


你在命令行安装的requests是在非虚拟环境下;IDE内选择的是python虚拟环境

谢谢老师指点,但两种方式都会报错
Collecting requests
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x111198f10>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x111198670>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1111b41c0>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1111b4310>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1111b4460>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’)’: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Max retries exceeded with url: /packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl (Caused by ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1111b45e0>, ‘Connection to files.pythonhosted.org timed out. (connect timeout=15)’))

WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the ‘/Users/longtengfei238/PycharmProjects/tester/venv/bin/python -m pip install --upgrade pip’ command.

设置成国内镜像参考
(1)阿里云 http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣http://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学http://pypi.hustunique.com/
需要先把官方源地址删除

搞定了,十分感谢

关闭