|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
:\Users\86131>pip install requests
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\commands\install.py", line 331, in run
resolver.resolve(requirement_set)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 281, in _get_abstract_dist_for
req.populate_link(self.finder, upgrade_allowed, require_hashes)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\req\req_install.py", line 249, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\index\package_finder.py", line 899, in find_requirement
req.name, specifier=req.specifier, hashes=hashes,
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\index\package_finder.py", line 881, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\index\package_finder.py", line 826, in find_all_candidates
project_url, link_evaluator=link_evaluator,
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\index\package_finder.py", line 794, in process_project_url
page_links = list(parse_links(html_page))
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\index\collector.py", line 255, in parse_links
namespaceHTMLElements=False,
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 46, in parse
p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 123, in __init__
getPhases(debug).items()])
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\html5lib\_utils.py", line 121, in wrapped
cache[key] = func(*args, **kwargs)
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 446, in getPhases
class Phase(with_metaclass(getMetaclass(debug, log))):
File "c:\users\86131\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\six.py", line 851, in __new__
resolved_bases = types.resolve_bases(bases)
AttributeError: module 'types' has no attribute 'resolve_bases'
论坛中的多数 pip 安装方法都试了,都报错。
AttributeError: module 'types' has no attribute 'resolve_bases' 大多是这个。
不过老实说,plan B可能也不行,分析了一下错误提示,问题出在types.py,python自带的types.py是有resolve_bases方法的,我怀疑还有一个types.py,其所在的目录在path中排在lib之前,这个types.py没有resolve_bases方法,所以报错。你试试搜索python目录下有没有第二个types.py,其在哪个目录下,看看其path是不是排在lib之前,这个命令获得python的path: import sys
print('\n'.join(sys.path))
还有两种可能:
1.你运行pip的当前目录下有一个types.py,有的话删掉;
2.系统自带的types.py有问题,没有resolve_bases方法,这个需要检查一下lib目录下的types.py,如果是这个问题,重装python是最佳方法。
|
|