问题描述
在按照在线教程创建Flask Web应用程序的同时,我试图使用sudo pip3 install flask-mysqldb
安装flask-mysqldb.这将导致安装错误,该错误似乎源于依赖性问题.错误消息如下Command "/usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-nbajn5in/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_eid7ul7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-nbajn5in/mysqlclient/
我无法找到任何资源来表明在放弃flask-mysqldb之外转而采用其他模块的方法.谢谢
While following an online tutorial to create a Flask web-app, I was trying to install flask-mysqldb with sudo pip3 install flask-mysqldb
. This results in an installation error which seems to stem from a dependency problem. The error message is as follows Command "/usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-nbajn5in/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_eid7ul7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-nbajn5in/mysqlclient/
I have not been able to find any resources indicating a way forward outside of abandoning flask-mysqldb in favour of another module. Thanks
推荐答案
感谢那些回答,我采用了一种解决方法,即下载另一个flask模块(flask-mysql),并使用它来访问我的MySQL DB.如果遇到此问题并希望实现flask-mysql
而不是flask-mysqldb
,请按照此处的说明 https://flask-mysql.readthedocs.io/en/latest/# .安装错误仍未解决,我将用flask-mysqldb人员记录下来.问候.
Thanks to those who replied, I employed a workaround by downloading another flask module (flask-mysql) and used that to access my MySQL DB.If you encounter this issue and wish to implement flask-mysql
instead of flask-mysqldb
follow the instructions here https://flask-mysql.readthedocs.io/en/latest/# .The installation error remains unsolved and I'll log it with the flask-mysqldb people.Regards.
这篇关于在Mac(OS High Sierra)上安装flask-mysqldb(python 3)期间发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!