解决pip安装报错“latin-1” codec can‘t encode...

场景:

ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
    local_path = unpack_url(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 282, in unpack_url
    return unpack_http_url(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 164, in unpack_http_url
    unpack_file(from_path, location, content_type)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/unpacking.py", line 261, in unpack_file
    untar_file(filename, location)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/unpacking.py", line 222, in untar_file
    with open(path, 'wb') as destfp:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 104-107: ordinal not in range(256)

 原因:系统环境不支持utf-8编码,在终端输入export LANG=en_US.UTF-8执行,也可写入/etc/profile

> vim /etc/profile

export LANG=en_US.UTF-8


> source /etc/profile

技术交流与资源分享(博主Q微同号: 446794914),感兴趣的朋友欢迎交流。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值