pip 安装pandas报UnicodeDecodeError: 'ascii' codec can't decode byte 0xd5错
2023-09-27 14:25:10 时间
当Python在window环境中通过pip安装pandas报标题这样的错,主要是因为python默认编码格式是:ascii
在https://www.python.org/dev/peps/pep-0100/文章中有如下介绍
Unicode Default Encoding
The Unicode implementation has to make some assumption about the encoding of 8-bit strings passed to it for coercion and about the encoding to as default for conversion of Unicode to strings when no specific encoding is given. This encoding is called <default encoding> throughout this text. For this, the implementation maintains a global which can be set in the site.py Python startup script. Subsequent changes are not possible. The <default encoding> can be set and queried using the two sys module APIs: sys.setdefaultencoding(encoding) --> Sets the <default encoding> used by the Unicode implementation. encoding has to be an encoding which is supported by the Python installation, otherwise, a LookupError is raised. Note: This API is only available in site.py! It is removed from the sys module by site.py after usage. sys.getdefaultencoding() --> Returns the current <default encoding>. If not otherwise defined or set, the <default encoding> defaults to 'ascii'. This encoding is also the startup default of Python (and in effect before site.py is executed). Note that the default site.py startup module contains disabled optional code which can set the <default encoding> according to the encoding defined by the current locale. The locale module is used to extract the encoding from the locale default settings defined by the OS environment (see locale.py). If the encoding cannot be determined, is unknown or unsupported, the code defaults to setting the <default encoding> to 'ascii'. To enable this code, edit the site.py file or place the appropriate code into the sitecustomize.py module of your Python installation.
解决方法:在python/lib/site.py中加入
import sys
reload(sys)
sys.setdefaultencoding('gbk')
问题就解决了。。。。。。。。。。。。
相关文章
- Windows Server中企业证书服务的安装
- centos7 yum安装LAMP
- windows安装spacy 2.3.5(pip && conda)并加载模型
- Thrift安装问题
- Python 查看pip安装的包的位置(查看pip安装包的路径)
- Python环境安装脚本,拷贝环境脚本,命令迁移模块(pip freeze >requirements.txt)
- Python——pip安装报错:is not a supported wheel on this platform
- 如何使用pip安装PythonMySQLdb模块?
- pip安装出现超时问题解决方案
- pip安装的python扩展模块自定义目录
- linux下安装pip
- 《树莓派渗透测试实战》——1.4 安装Kali Linux
- LINUX对于未安装的软件包的查看
- 大数据学习——flume安装部署
- Ubuntu18.04终端alacritty安装及配置
- MindSpore1.3.0 GPU pip方式安装 —— Ubuntu18.04系统 (最终安装结果为成功)需要管理员权限,sudo安装
- linux下nginx安装与设置开机启动
- Centos 5.2安装配置DNS服务器
- Windows下Python中pip安装Pillow报错总结(转载)
- CentOS桌面安装
- MyEclipse2014安装图解
- hbase1.4.0安装和使用
- odoo14 odoo15 有时安装时提示pip 需更新
- 安装pip
- Vmware 安装Ubuntu 20.04桌面版
- windows下面安装Python和pip终极教程