安装PyMysql报错 python setup.py egg_info Check the logs for full command output.

本文记录了在Python环境中安装PyMySQL模块时遇到的错误及解决过程。错误主要源于setup.py在执行egg_info命令时出现问题,具体表现为无法正确处理带有utf-8编码的文件。文章提供了详细的解决步骤,包括从指定源下载安装包、解压并手动执行安装命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

报错信息

Looking in indexes: http://pypi.douban.com/simple/
Collecting pymysql
Downloading http://pypi.doubanio.com/packages/2b/c4/3c3e7e598b1b490a2525068c22f397fda13f48623b7bd54fb209cd0ab774/PyMySQL-1.0.0.tar.gz (45 kB)
|████████████████████████████████| 45 kB 3.8 MB/s
ERROR: Command errored out with exit status 1:
command: /home/wyf/.virtualenvs/python2.7/bin/python -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-i04pFU/pymysql/setup.py’"’"’; file=’"’"’/tmp/pip-install-i04pFU/pymysql/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 /tmp/pip-pip-egg-info-ZuuABi
cwd: /tmp/pip-install-i04pFU/pymysql/
Complete output (5 lines):
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-i04pFU/pymysql/setup.py”, line 6, in
with open("./README.rst", encoding=“utf-8”) as f:
TypeError: ‘encoding’ is an invalid keyword argument for this function
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

先下载安装包

  • https://pypi.doubanio.com/simple/pymysql/

在这里插入图片描述

解压

tar zxvf PyMySQL-0.10.1.tar.gz 
---解压后进入目录
cd PyMySQL-0.10.1/

安装

python setup.py install

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值