[英]How to install flask-mysql for python3?
I tried to install flask-mysql from pip3 to python3, but it throws exception.我试图将flask-mysql从pip3安装到python3,但它抛出异常。 Here is log.这是日志。
Running setup.py (path:/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py) egg_info for package MySQL-python
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
So, how to install flask-mysql to python3?那么,如何在python3上安装flask-mysql呢?
PS I tried to install both with "pip3 install flask-mysql" and "pip install Flask...whl". PS我尝试使用“pip3 install flask-mysql”和“pip install Flask...whl”进行安装。
Flask-MySQL uses MySQL-Python, which doesn't support Python 3, and there has been an open issue about it for over a year. Flask-MySQL 使用 MySQL-Python,它不支持 Python 3,并且有一个关于它的公开问题已经一年多了。 Use Flask-MySQLdb instead, which uses MySQLclient.改用 Flask-MySQLdb,它使用 MySQLclient。
pip install flask-mysqldb
Or use SQLAlchemy, a much more powerful interface for working with databases.或者使用 SQLAlchemy,这是一个用于处理数据库的更强大的界面。
pip install flask-sqlalchemy mysqlclient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.