pip3 install mysql-python 失败,/tmp/pip-install-4nev4id4/mysql-python/ 中的错误代码为 1
pip3 install mysql-python failed with error code 1 in /tmp/pip-install-4nev4id4/mysql-python/
我是 python on flask 的新手,当我尝试通过输入
安装 mysql-python
在终端
中执行以下命令
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/
然后我使用这个命令
sudo apt install default-libmysqlclient-dev
在许多人建议的终端中,我在 Whosebug 上查看过。
然后我重试安装 mysql-python 但它也显示相同的错误,任何人都可以帮助我。
MySQL-python不支持python3。这就是为什么您会收到此特定错误
ModuleNotFoundError: No module named 'ConfigParser'
在 python3 中 ConfigParser
更名为 configparser
连接到 MySQL 数据库的一个选项是 official python connector
另一种选择是pyodbc
其他答案中提供了其他选项
mysql-python 仅支持 Python 2.x,而您似乎正在使用 Python 3. 从链接的 PyPI 页面:
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,您可以使用其他替代方法:
我是 python on flask 的新手,当我尝试通过输入
安装 mysql-python
在终端
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/
然后我使用这个命令
sudo apt install default-libmysqlclient-dev
在许多人建议的终端中,我在 Whosebug 上查看过。
然后我重试安装 mysql-python 但它也显示相同的错误,任何人都可以帮助我。
MySQL-python不支持python3。这就是为什么您会收到此特定错误
ModuleNotFoundError: No module named 'ConfigParser'
在 python3 中 ConfigParser
更名为 configparser
连接到 MySQL 数据库的一个选项是 official python connector
另一种选择是pyodbc
其他答案中提供了其他选项
mysql-python 仅支持 Python 2.x,而您似乎正在使用 Python 3. 从链接的 PyPI 页面:
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,您可以使用其他替代方法: