[英]Installing matplotlib using pip gives errors
我想將 matplotlib 導入我的 python 代碼,但不幸的是它在安裝時出錯。 我可以成功安裝 numpy 但是在安裝 matplotlib 時出現異常錯誤。 我正在使用 Python 3.7.0 版本。
python -m pip install matplotlib
我使用了上面的命令。cmd 中出現了以下錯誤。
C:\Users\ASUS>python -m pip install matplotlib
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main
status = self.run(options, args)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\cli\req_command.py", line 185, in wrapper
return func(self, options, args)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\commands\install.py", line 333, in run
reqs, check_supported_wheels=not options.target_dir
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 179, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 362, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 313, in _get_abstract_dist_for
self._populate_link(req)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 279, in _populate_link
req.link = self.finder.find_requirement(req, upgrade)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\package_finder.py", line 901, in find_requirement
req.name, specifier=req.specifier, hashes=hashes,
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\package_finder.py", line 883, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\package_finder.py", line 828, in find_all_candidates
project_url, link_evaluator=link_evaluator,
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\package_finder.py", line 796, in process_project_url
page_links = list(parse_links(html_page))
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\collector.py", line 346, in wrapper_wrapper
return list(fn(page))
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\index\collector.py", line 360, in parse_links
namespaceHTMLElements=False,
File "C:\Users\ASUS\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\ASUS\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 123, in __init__
getPhases(debug).items()])
File "C:\Users\ASUS\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\ASUS\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\ASUS\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'
我用與上述相關的幾個命令嘗試了幾次,然后重新啟動並再次嘗試。 但無法安裝。 由於我是新手,任何人都可以幫我解決這個問題。 先感謝您。
首先檢查“python”代碼是否正確響應。 使用“C:\”路徑,您可以使用“cd..”代碼更改路徑,然后嘗試代碼“pip install matplotlib”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.