我在cmd中使用了pip install wordcloud然后我陷入了解码错误,这里是错误信息:
Collecting wordcloud
Using cached wordcloud-1.3.1.tar.gz
Requirement already satisfied: matplotlib in c:\python\python36\lib\site-packages (from wordcloud)
Requirement already satisfied: numpy>=1.6.1 in c:\python\python36\lib\site-packages (from wordcloud)
Requirement already satisfied: pillow in c:\python\python36\lib\site-packages (from wordcloud)
Requirement already satisfied: pytz in c:\python\python36\lib\site-packages (from matplotlib->wordcloud)
Requirement already satisfied: cycler>=0.10 in c:\python\python36\lib\site-packages (from matplotlib->wordcloud)
Requirement already satisfied: six>=1.10 in c:\python\python36\lib\site-packages (from matplotlib->wordcloud)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in c:\python\python36\lib\site-packages (from matplotlib->wordcloud)
Requirement already satisfied: python-dateutil in c:\python\python36\lib\site-packages (from matplotlib->wordcloud)
Requirement already satisfied: olefile in c:\python\python36\lib\site-packages (from pillow->wordcloud)
Installing collected packages: wordcloud
Running setup.py install for wordcloud ... error
Exception:
Traceback (most recent call last):
File "c:\python\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 55: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\python\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "c:\python\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\python\python36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 55: invalid start byte
问题似乎是由解码造成的,请帮我解决这个问题,非常感谢!
答案 0 :(得分:0)
在
中打开文件C:\Python36\Lib\site-packages\pip\compat\__init__.py
更改' utf_8'到' cp936'并保存,然后再次使用pip install。