我的MacBook Pro中安装了蟒蛇3.6.5和anaconda 5.2.0。如果我尝试通过pip install
安装任何库,则会收到以下错误消息。你能让我知道为什么吗?在下面,我将提供一个pip install spacy
的示例。
$ pip install spacy
Collecting spacy
Exception:
Traceback (most recent call last):
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 143, in main
status = self.run(options, args)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 318, in run
resolver.resolve(requirement_set)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 218, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 164, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/index.py", line 572, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/index.py", line 534, in find_all_candidates
self._package_versions(page.iter_links(), search)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/index.py", line 701, in _package_versions
for link in self._sort_links(links):
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/index.py", line 690, in _sort_links
for link in links:
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_internal/index.py", line 880, in iter_links
namespaceHTMLElements=False,
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/html5parser.py", line 47, in parse
return p.parse(doc, **kwargs)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/html5parser.py", line 289, in parse
self._parse(stream, False, None, *args, **kwargs)
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/html5parser.py", line 134, in _parse
self.mainLoop()
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/html5parser.py", line 205, in mainLoop
for token in self.normalizedTokens():
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/html5parser.py", line 264, in normalizedTokens
for token in self.tokenizer:
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/_tokenizer.py", line 59, in __iter__
while self.state():
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/_tokenizer.py", line 243, in dataState
data = self.stream.char()
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/_inputstream.py", line 246, in char
if not self.readChunk():
File "/Users/sh0/anaconda3/lib/python3.6/site-packages/pip/_vendor/html5lib/_inputstream.py", line 265, in readChunk
data = self.dataStream.read(chunkSize)
File "/Users/sh0/anaconda3/lib/python3.6/codecs.py", line 499, in read
data = self.bytebuffer + bytes(newdata,encoding='utf8')
TypeError: encoding without a string argument
答案 0 :(得分:0)
我将从运行pip list --outdated
开始,它将显示哪些模块已过期,但是这样做将为您提供正确的方法来更新pip(如果数据不足),您应该这样做python -m pip install pip --upgrade
还可以在启用最大详细度的情况下尝试安装命令吗? (pip install -vvv ...
)。
祝你好运,希望对你有帮助。