首页 > Windows开发 > 详细

【Windows】anaconda虚拟环境中安装包显示编码错误

时间:2020-11-23 09:09:39      阅读:95      评论:0      收藏:0      [点我收藏+]

使用cmd命令窗在conda的虚拟环境中使用pip或者conda命令安装包时,显示如下错误:

    ERROR: Command errored out with exit status 3221226505:
     command: C:\SoftWare\Anaconda\envs\pytorch\python.exe -c import sys, setuptools, tokenize; sys.argv[0] = ‘""‘C:\\Users\\CRUISE~1\\AppData\\Local\\Temp\\pip-req-build-6wd_bvgm\\setup.py‘""‘; __file__=‘""‘C:\\Users\\CRUISE~1\\AppData\\Local\\Temp\\pip-req-build-6wd_bvgm\\setup.py‘""‘;f=getattr(tokenize, ‘""‘open‘""‘, open)(__file__);code=f.read().replace(‘""‘\r\n‘""‘, ‘""‘\n‘""‘);f.close();exec(compile(code, __file__, ‘""‘exec‘""‘)) egg_info --egg-base C:\Users\CRUISE~1\AppData\Local\Temp\pip-req-build-6wd_bvgm\pip-egg-info
         cwd: C:\Users\CRUISE~1\AppData\Local\Temp\pip-req-build-6wd_bvgm    Complete output (4 lines):
    Fatal Python error: init_sys_streams: cant initialize sys standard streams
    LookupError: unknown encoding: 65001

    Current thread 0x00002cec (most recent call first):
    ----------------------------------------
ERROR: Command errored out with exit status 3221226505: python setup.py egg_info Check the logs for full command output.

由错误可以看出是编码引起的,但是按照网上的方法使用chcp 936(简中)或者65001(UTF-8)都不行,原因应该是python不将65001识别为utf-8,之后使用以下命令解决:

set PYTHONIOENCODING=utf-8

 

【Windows】anaconda虚拟环境中安装包显示编码错误

原文:https://www.cnblogs.com/lhdb/p/14022495.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!