我有win10(64位),我正在使用python 3.6.2
我在cmd上尝试了$ pip install openpyxl
,但收到了以下错误:
> C:\Users\Joctã Argôlo>pip install openpyxl
> Collecting openpyxl Using
> cached openpyxl-2.4.8.tar.gz Requirement already satisfied: jdcal in
> c:\users\joctãargôlo\appdata\local\programs\python\python36\lib\site-packages (from openpyxl)
> Requirement already satisfied: et_xmlfile in c:\users\joctãargôlo\appdata\local\programs\python\python36\lib\site-packages (from openpyxl)
> Installing collected packages: openpyxl Running setup.py
> install for openpyxl ... error Exception:
追踪(最近一次呼叫最后一次):
File "c:\users\joctãargôlo\appdata\local\programs\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 0xe3 in position 56: invalid continuation byte
在处理上述例外期间,发生了另一个例外:
回溯(最近一次调用最后一次):File "c:\users\joctãargôlo\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "c:\users\joctã argôlo\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run prefix=options.prefix_path, File "c:\users\joctã argôlo\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install **kwargs File "c:\users\joctã argôlo\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 878, in install spinner=spinner, File "c:\users\joctã argôlo\appdata\local\programs\python\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess line = console_to_str(proc.stdout.readline()) File "c:\users\joctãargôlo\appdata\local\programs\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 0xe3 in position 56: invalid continuation byte
我该如何解决这个问题?
答案 0 :(得分:1)
当您以一些疯狂的字母命名文件夹时,总会发生此错误。 “JoctãArgôlo”
以这种方式错误对我们说“嘿,伙计!你到底放了什么?!!”
C:\用户\joctã argôlo\应用程序数据\本地\程序\蟒\ python36 \ lib中\站点包\ PIP \ compat__init __。PY
return s.decode(sys.__stdout__.encoding)
到
return s.decode('cp1251')
cp1251 - 是我用russians语言(From my solution)的解决方案。把你自己的编码(Portugale?)放在你有一个文件夹中。你必须了解她。 并且只要您不更改用户文件夹的名称 - 请不要更改python文件中的条目。 更新无法解决问题。