当前位置:主页 > 软件编程 > Python代码 >

完美解决Python 2.7不能正常使用pip install的问题

时间:2021-06-26 08:46:43 | 栏目:Python代码 | 点击:

主要原因是用户目录编码使用了中文,解决方法如下:

pip安装python包会加载我的用户目录,我的用户目录恰好是中文的,ascii不能编码。

解决办法是:

python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py

内容写:

import sys 
sys.setdefaultencoding('gb2312') 

python会自动运行这个文件。

您可能感兴趣的文章:

相关文章