[英]Python Flask_MYSQLDB problems
Hi你好
I have been following a step by step on how to make a login system with python , with flask-mysqldb.我一直在逐步了解如何使用 python 和 flask-mysqldb 制作登录系统。 I'm trying to run the python script, but i end up getting a error message that i don't understand so much of.
我正在尝试运行 python 脚本,但我最终收到一条我不太了解的错误消息。
from flask import Flask, render_template, request, redirect, url_for, session
from flask_mysqldb import MySQL
import MySQLdb.cursors
import re
app = flask(__name__)
When I'm trying to run the script, on the localhost page it also shows a error , I have copyed and pasted te error in pastebin.当我尝试运行脚本时,在 localhost 页面上它也显示错误,我已将错误复制并粘贴到 pastebin 中。 When I try to install the flask_mysqldb i get a error in my cmd.
当我尝试安装 flask_mysqldb 时,我的 cmd 出现错误。 Here is what my cmd says .
这是我的 cmd 所说的。
I have google with parts of the error, trying to find some information about what the problem can be.我有部分错误的谷歌,试图找到一些关于问题可能是什么的信息。 And tryed to pip install a lot for things that some people have said that can work, without any luck.
并尝试在 pip 安装很多东西,有些人说可以工作,但没有任何运气。 And can't figure out how to get this to work.
并且无法弄清楚如何让它发挥作用。
I also tryed to install Anaconda terminal to run the command in there for installing flask_mysqldb, but no luck.我还尝试安装 Anaconda 终端以在其中运行安装flask_mysqldb的命令,但没有运气。 Tryed to uninstall and reinstall everything, but nothing changed the error i get.
尝试卸载并重新安装所有内容,但没有改变我得到的错误。
The error:错误:
ModuleNotFoundError: No module named 'flask_mysqldb'
indicates that the module has not been installed or installed in a wrong environment.表示该模块没有安装或安装在错误的环境中。 Install it using:
安装它使用:
pip install flask-mysqldb
The stack from from the error来自错误的堆栈
File "c:\users\chris\appdata\local\programs\python\python37-32\lib\site-packages\flask\cli.py", line 240, in locate_app
__import__(module_name)
File "C:\xampp\htdocs\pythonlogin\main.py", line 2, in <module>
from flask_mysqldb import MySQL
ModuleNotFoundError: No module named 'flask_mysqldb'
is indicating that Python 3.7 in involved.表示涉及Python 3.7。
In this case, using pip
to install flask_mysqldb
will lead to grief.在这种情况下,使用
pip
安装flask_mysqldb
将导致悲痛。 Use pip3
instead.请改用
pip3
。 Eg,例如,
pip3 install flask_mysqldb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.