pip3安装mysql-python失败,错误代码为/tmp/pip-install-4nev4id4/mysql-python/ [英] pip3 install mysql-python failed with error code 1 in /tmp/pip-install-4nev4id4/mysql-python/
问题描述
当我尝试通过输入
来安装mysql-python时,我是烧瓶上的python的新手.
在终端
I am new in python on flask, when i try to install mysql-python by entering the
following command in terminal
pip3 install mysql-python
它显示以下错误:
Collecting mysql-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-4nev4id4/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/tmp/pip-install-4nev4id4/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-4nev4id4/mysql-python/
然后我使用此命令
我在stackoverflow上检查过的很多建议都显示了终端中的sudo apt install default-libmysqlclient-dev
.
and then I use this command
sudo apt install default-libmysqlclient-dev
in terminal which has been suggested by many i checked on stackoverflow.
然后我重试安装mysql-python,但它也显示相同的错误,有人可以帮助我吗.
and then I retry to install mysql-python but also it is showing the same error, can anyone please help me.
推荐答案
mysql-python 仅支持Python 2.x,而您似乎正在使用Python3.在链接的PyPI页面中:
mysql-python only supports Python 2.x, while you seem to be using Python 3. From the linked PyPI page:
MySQL-3.23至5.5和Python-2.4至2.7当前 支持的.将来的版本将支持Python-3.0.
MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release.
要从Python 3连接到MySQL,您可以使用其他替代方法:
To connect to MySQL from Python 3 you can use other alternatives:
- mysqlclient
- mysql-connector-python
- pymysql
- cymysql
这篇关于pip3安装mysql-python失败,错误代码为/tmp/pip-install-4nev4id4/mysql-python/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!