【发布时间】:2020-11-01 18:30:31
【问题描述】:
我尝试在ubuntu中安装mysql-python,但还是不成功,我之前用的是win10,从来没有遇到过这个问题。
我用
pip3 install MySql-python
我遇到了以下错误:
Using cached MySQL-python-1.2.5.zip (108 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j3febudn/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j3febudn/mysql-python/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-install-j3febudn/mysql-python/pip-egg-info
cwd: /tmp/pip-install-j3febudn/mysql-python/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-j3febudn/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/tmp/pip-install-j3febudn/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
【问题讨论】:
-
MySQL 在其页面上有专门的 Python 模块。也许用它来代替
MySql-python- 请参阅connector/python - 甚至还有专门针对 Ubuntu 20.04 的版本。我将它与基于 Ubuntu 18.04 的 Linux Mint 19.3 一起使用 -
顺便说一句:connector/python 的文档 - 您可以直接使用它,也可以在 SQLAlchemy 中使用它。
-
@furas THankyou,这实际上对我有用。
标签: python linux ubuntu mysql-python