gpt4 book ai didi

python - 通过 pip 安装 SQLAlchemy 时出现 UnicodeDecodeError

转载 作者:太空宇宙 更新时间:2023-11-03 15:48:23 24 4
gpt4 key购买 nike

我正在尝试通过 pip 安装 SQLAlchemy。然而,我失败了。

我的操作系统是Windows 10中文版,使用的是Python 3.6.0。

我在互联网上搜索了我的问题,得到了很多解决方案,说我可以将 sys.setdefaultencoding 添加到某个文件中。但我使用的是Python3。

我还发现了一个issue on Github这似乎正是我的问题。但是将我的代码页更改为 866 或 65001 根本不起作用...

信息如下:

C:\Users\59740>pip install SQLAlchemy
Collecting SQLAlchemy
Using cached SQLAlchemy-1.1.4.tar.gz
Installing collected packages: SQLAlchemy
Running setup.py install for SQLAlchemy ... error
Exception:
Traceback (most recent call last):
File "c:\program files\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 0xb6 in position 34: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\program files\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 0xb6 in position 34: invalid start byte

最佳答案

打开\python36\lib\site-packages\pip\compat__init__.py 75return s.decode('utf_8') 更改为

return s.decode('cp936')

其他:chcp cmd 显示当前代码页

关于python - 通过 pip 安装 SQLAlchemy 时出现 UnicodeDecodeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41566434/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com