各位大神,求求大家,来帮我看看吧,我已经没招了,3 天了问题都没解决,就差重装系统了!!,问题是 Python 当中 pip 安装库出现错误

2017-10-02 13:53:25 +08:00
 a1060778506

第一次用这个网站不熟悉,不能发图片,我直接贴错误代码 了

C:\Program Files\Python37\pip-9.0.1>pip install requests Collecting requests Exception: Traceback (most recent call last): File "C:\Program Files\Python37\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "C:\Program Files\Python37\lib\site-packages\pip\commands\install.py", line 324, in run requirement_set.prepare_files(finder) File "C:\Program Files\Python37\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "C:\Program Files\Python37\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file require_hashes File "C:\Program Files\Python37\lib\site-packages\pip\req\req_install.py", line 278, in populate_link self.link = finder.find_requirement(self, upgrade) File "C:\Program Files\Python37\lib\site-packages\pip\index.py", line 465, in find_requirement all_candidates = self.find_all_candidates(req.name) File "C:\Program Files\Python37\lib\site-packages\pip\index.py", line 423, in find_all_candidates for page in self._get_pages(url_locations, project_name): File "C:\Program Files\Python37\lib\site-packages\pip\index.py", line 568, in _get_pages page = self._get_page(location) File "C:\Program Files\Python37\lib\site-packages\pip\index.py", line 683, in _get_page return HTMLPage.get_page(link, session=self.session) File "C:\Program Files\Python37\lib\site-packages\pip\index.py", line 792, in get_page "Cache-Control": "max-age=600", File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\sessions.py", line 488, in get return self.request('GET', url, **kwargs) File "C:\Program Files\Python37\lib\site-packages\pip\download.py", line 386, in request return super(PipSession, self).request(method, url, *args, **kwargs) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\sessions.py", line 596, in send r = adapter.send(request, **kwargs) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\cachecontrol\adapter.py", line 47, in send resp = super(CacheControlAdapter, self).send(request, **kw) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\adapters.py", line 423, in send timeout=timeout File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\packages\urllib3\connectionpool.py", line 589, in urlopen self._prepare_proxy(conn) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\packages\urllib3\connectionpool.py", line 797, in _prepare_proxy conn.connect() File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\packages\urllib3\connection.py", line 254, in connect conn = self._new_conn() File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "C:\Program Files\Python37\lib\site-packages\pip_vendor\requests\packages\urllib3\util\connection.py", line 66, in create_connection if host.startswith('['): AttributeError: 'NoneType' object has no attribute 'startswith'

C:\Program Files\Python37\pip-9.0.1> C:\Program Files\Python37\pip-9.0.1>

这是我,安装一个最简单的库 pip install requests 没有其他的库 安装失败了,我重装过 python 和 pip 版本是 python3.7, pip 是最新版, 不要再说,是版本的问题,因为我在其他两台电脑上面用相同的安装包,都是可以正常安装的, 我重装之后,清理过注册表,能清理的方式都清理过了,也使用过,管理权安装,也更换过,安装盘符,变量路径也添加了,也使用过.whl 的方式安装,也使用过 Anaconda,但是都是不可以的,我又回到了原点,如果谁可以帮我解决,我有偿也是情愿的,感激不尽!!!

5785 次点击
所在节点    Python
32 条回复
necomancer
2017-10-02 14:25:53 +08:00
anaconda 里应该有带 requests 吧,能把 conda install requests 或者 conda install request 的安装包 的报错(如果有)发出来吗?
a1060778506
2017-10-02 14:31:32 +08:00
@necomancer 我已经卸载掉了,报错和这个是一样的
a1060778506
2017-10-02 14:35:10 +08:00
@necomancer 神啊,能拯救我吗
supersu
2017-10-02 15:14:18 +08:00
建议虚拟机上 linux,一劳永逸
ferencz
2017-10-02 15:32:56 +08:00
毅力可嘉,我不懂,还是推荐你重装系统吧。
boboliu
2017-10-02 16:00:13 +08:00
3.7.0 alpha 1: 2017-09-19

勇气可嘉
necomancer
2017-10-02 16:22:44 +08:00
@a1060778506 呃,我是说你装上 anaconda 然后 anaconda 的 python 里自带 requests,而且 anaconda 的 conda install 和 pip install 不太一样,现在不清楚是软件环境还是只是 pip 出的错,所以建议你试试 anaconda,并且用 conda install 试试在线 /离线包。还有,试试 pip 安装别的包,看有什么问题。
necomancer
2017-10-02 16:28:21 +08:00
哎嘛,你这是 py37.... anaconda 没有 py37 吧……非要这个版本吗?
necomancer
2017-10-02 16:29:09 +08:00
试试去 github.com/kennethreitz/requests 下载 zip,解压 cd 到目录用 pip install . 试试,看看报错
necomancer
2017-10-02 16:34:21 +08:00
不过我还是建议试试 pip 安装其他包。顺便问一下,你这个机器有没有配置过 pip/anaconda 的代理之类的设置?
a1060778506
2017-10-02 16:46:42 +08:00
@necomancer 其他版本也是这样
a1060778506
2017-10-02 16:47:10 +08:00
@necomancer 没有配置过代理,其他包也这样
a1060778506
2017-10-02 16:47:32 +08:00
@necomancer 没有配置过代理,其他包————也这样
a1060778506
2017-10-02 16:48:38 +08:00
@necomancer 这一条我试过了,错误是一样的
vainl1
2017-10-02 16:58:07 +08:00
python -m pip
lcc4376
2017-10-02 17:52:39 +08:00
venv 上試試?
flynaj
2017-10-02 18:56:46 +08:00
彻底点直接转 golang
foo2bar
2017-10-02 19:26:29 +08:00
请“以管理员身份运行命令行提示符”,在这里面执行 pip install request
sylecn
2017-10-02 20:29:49 +08:00
同情。不过放假了,不想答题>_<

建议懂的人直接帮 LZ 远程安装一下
HFcbyqP0iVO5KM05
2017-10-02 20:34:37 +08:00
附议 18 楼,同时建议试试用 pip 安装其它的包看看会不会报错,是什么错

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/395135

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX