报错如下:
Collecting PyMySQL>=1.0.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2b/c4/3c3e7e598b1b490a2525068c22f397fda13f48623b7bd54fb209cd0ab774/PyMySQL-1.0.0.tar.gz (45 kB)
ERROR: Command errored out with exit status 1:
command: /bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8fspQ4/pymysql/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8fspQ4/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-1YpVoa
cwd: /tmp/pip-install-8fspQ4/pymysql/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-8fspQ4/pymysql/setup.py", line 6, in <module>
with open("./README.rst", encoding="utf-8") as f:
TypeError: 'encoding' is an invalid keyword argument for this function
报错原因:
-
问题分析:
- 在安装 PyMySQL 版本 1.0.0 时,出现了错误。
- 错误提示中显示
TypeError: 'encoding' is an invalid keyword argument for this function
,表明使用了无效的关键字参数。
解决办法:
1.去源地址下载pymysql
下载对应版本pymysql
2.复制下载包到任意文件夹
(1)解压下载包
(2)找到setup.py文件编辑
把with open("./README.rst", encoding="utf-8") as f:
替换成:with open("./README.rst",) as f:
原:
编辑后:
3.将编辑后整个解压文件打包 放到python项目里
并修改executor.sh命令