我在用pip安装一些第三方库时,总会报错,错误如下:

提示:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 inposition 34: ordinal

not in range(128)

ascii编码不能解码问题,查了好久,纠结了好久,终于找出问题所在了。。。。。。答案在下面!

>pip install sh

Downloading/unpacking sh

Cleaning up...

Exception:

Traceback (most recent call last):

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm

and.py", line 134, in main

status = self.run(options, args)

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands

\install.py", line 236, in run

requirement_set.prepare_files(finder,force_root_egg_info=self.bundle, bundl

e=self.bundle)

File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py",

line 1092, in prepare_files

self.unpack_url(url, location,self.is_download)

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py",

line 1238, in unpack_url

retval = unpack_http_url(link, location,self.download_cache, self.download_

dir)

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\download

.py", line 621, in unpack_http_url

temp_location = os.path.join(temp_dir,filename)

File "D:\developer\Python27\lib\ntpath.py",line 108, in join

path += "\\" + b

UnicodeDecodeError: 'ascii' codec can'tdecode byte 0xb1 in position 9: ordinal

not in range(128)

Traceback (most recent call last):

File"D:\developer\Python27\Scripts\pip-script.py", line 9, in<module>

load_entry_point('pip==1.4.1','console_scripts', 'pip')()

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\__init__

.py", line 148, in main

return command.main(args[1:], options)

File"D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm

and.py", line 169, in main

text = '\n'.join(complete_log)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 inposition 34: ordinal

not in range(128)

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

解决办法是: 
python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py 
内容写: 
import sys 
sys.setdefaultencoding('gbk') 
python会自动运行这个文件。

pip install 出现报asciii码错误的问题相关推荐

  1. pip install jupyter报错30ERROR

    pip install juptyer报错30ERROR 报的错误如下: 30ERROR: Exception: Traceback (most recent call last):File &quo ...

  2. Windows上pip install kenlm报错解决

    Windows上pip install kenlm报错解决 解决办法1: 一般在windows上安装kenlm会遇到与Microsoft Visual C++ 14.0 is required相关的问 ...

  3. mac安装sudo pip install MySQL-python报错EnvironmentError: mysql_config not found解决方法

    PATH="/usr/local/mysql/bin:${PATH}" export PATH export DYLD_LIBRARY_PATH=/usr/local/mysql/ ...

  4. pip install 命令报错Temporary failure in name resolution

    pip install 命令报如下错误 Collecting labelmeUsing cached https://files.pythonhosted.org/packages/79/a4/01b ...

  5. python pip install syntaxerror_解决pip install xxx报错SyntaxError: invalid syntax的问题

    python--pip install xxx报错SyntaxError: invalid syntax 在安装好python后,进入python运行环境后,因为我要用pip安装开发Web App需要 ...

  6. pip install flask-mongoengine报错

    pip install flask-mongoengine报错 报错如下: Collecting pytz (from -r /srv/wms/engine/requirements.txt (lin ...

  7. 关于pip install ensemble-boxes报错的处理

    ensemble-boxes是CVPR2020年发表的Weight Boxes Fusion论文中提出算法的作者开源的第三方库. 里面实现了WBF后处理算法s 具体的请见github:https:// ...

  8. pip install execjs报错

    pip install execjs报错: Could not find a version that satisfies the requirement execjs (from versions: ...

  9. pip install python-docx报错_python各种模块的安装

    对于python3,有许多模块官方的不合适,可以在这里找http://www.lfd.uci.edu/~gohlke/pythonlibs/ 1.openpyxl处理Excel文档的模块 首先,需要安 ...

最新文章

  1. ubuntu 命令整合1
  2. shell实例第9讲:判断用户输入的是否为IP地址
  3. matlab 二维线图绘制函数 plot用法参数
  4. Redis的List操作
  5. apache ignite_通过示例获取Apache Ignite Baseline拓扑
  6. 容量耦合系数模型_期刊在线 | 基于ALE流固耦合方法的刷式密封泄漏特性理论与实验研究...
  7. 八、图形与图像处理(2)
  8. 全国高校计算机课程教学系列报告会,西安交大承办2013年全国高校物理课程教学系列报告会...
  9. Silverlight 参考: Path的Data生成归总
  10. iris数据_Python数据分析02-Iris-直方图与KDE
  11. 8plus基带电源供电线路_iPhone7显示手机无服务还有感叹号,基带通病问题,你中招了吗?...
  12. 二次线性插值实现图像放大(计算机视觉)
  13. 【Python】聊聊Python ctypes 模块
  14. js获取图片点坐标值
  15. Snipaste——一款强大又实用的截图工具
  16. 计算错误可以用计算机ac,计算器AC是什么键?
  17. 201609-3 炉石传说
  18. cat全链路监控_CAT分布式监控系统(一):CAT功能介绍 CAT监控系统是什么、能做什么?...
  19. 从B站的代码泄露事件中,我们能学到些什么?
  20. TI推出工业市场最强异构处理器AM57X 双核A15怕不怕

热门文章

  1. 安装chrome_Chrome 离线安装包下载
  2. 游标循环读取的正确逻辑_千分尺的正确使用方法原来是这样?我用了那么多年都用错了...
  3. M1芯片Mac也可以安装Windows系统啦 使用PD16虚拟机安装ARM版Windows10教程
  4. C++游戏入门书籍推荐
  5. 1.5 编程基础之循环控制 44 第n小的质数
  6. 程序员找工作防止小破公司的画饼充饥方法
  7. 【C#桌面应用】第二节:利用Visual Studio2019 创建桌面应用
  8. 基于JavaFX实现的数据库学生管理系统
  9. python实现模拟按键下拉_利用 Python 实现 Windows 下的鼠标键盘模拟
  10. PHP笔记-自定义MVC框架