Win10上Python3通过pip安装时出现UnicodeDecodeError

我在通过pip安装时遇到了UnicodeDecodeError。

系统是windows10,python版本是3.6.0。

完整的信息如下:

C:\Windows\system32>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

我已经试过用“chcp 65001”修改代码页,然而并没有什么效果。也试过“chcp 866”的办法,也没什么效果。

我也查到很多在各种地方用sys.setdefaultencoding的办法,然而我用的是python3啊……

更新:

我在stackoverflow上看到建议修改代码页为437之后,不仅是上面的问题了……还遇到了PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。

报错信息如下:

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:\users\59740\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode
  • 10
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 21
    评论
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值