python常见问题及解决

一、安装第三方库

1、安装paramiko报错,[错误记录]paramiko模块错误:from_buffer() cannot return the address of the raw string

先执行python -m pip install --no-use-pep517 bcrypt,再执行pip install paramiko

pip install --upgrade cryptography

pip install --upgrade dnspython

pip install --upgrade pyldap

2、安装 psycopg2

使用yum方式安装psycopg2,yum install -y python-psycopg2

3、安装xlutils

执行pip install xlutils

4、不识别xlsx文件

需要下载xlrd==1.2.0版本,因为目前xlrd更新到了2.0.1版本,只支持.xls文件。

所以如果需要读取.xlsx文件,需要安装旧版本。

#如果之前安装过,需要卸载原先版本

pip uninstall xlrd

#下载1.2.0版本

pip install xlrd==1.2.0

报错UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-5: ordinal not in range(128)

因为Python2默认使用ASCII编码处理中文

设置语言会采用的系统环境变量值为utf-8:export LC_ALL="en_US.utf8"

相关推荐
Fcy6481 分钟前
C++ 模版(进阶)(含array解析)
开发语言·c++·stl·array·模版
OKkankan7 分钟前
多态概念及使用
开发语言·数据结构·c++·算法
hudawei9967 分钟前
kotlin协程编译成Android字节码后是什么样的
android·开发语言·kotlin
沐雪轻挽萤10 分钟前
pytorch模型部署基础知识
人工智能·pytorch·python
xxxxxmy15 分钟前
相向双指针—接雨水
python·相向双指针
nix.gnehc16 分钟前
PyTorch数据加载与预处理
人工智能·pytorch·python
小周码代码18 分钟前
js 数字金额转为大写 js 金额转大写
开发语言·前端·javascript·js工具
行走在电子领域的工匠20 分钟前
台达ST:自定义串行通讯传送与接收指令COMRS程序范例五
开发语言·台达plc·st语言编程·串口自定义协议
Sindy_he25 分钟前
2025最新版微软GraphRAG 2.0.0本地部署教程:基于Ollama快速构建知识图谱
python·microsoft·大模型·知识图谱·rag
BillKu29 分钟前
html2pdf.js使用与配置详解
开发语言·javascript·ecmascript