situation
SQLALCHEMY_ DATABASE_ URI = ‘ mysql://username:password@server/db ‘
1
after operation, MySQL reports an error importerror: no module named ‘MySQL db’.
why
since there is no MySQL DB module, follow the normal idea
pip install MySQLdb
1
it should be able to solve this problem, but no corresponding module can be found. After checking, this is because mysql-3.23 through 5.5 and python-2.4 through 2.7 are currently supported.
solutions
looking for alternatives
in Python 3, we generally use pymysql.
implementation
pip install PyMySQL
1
change the database connection to
mysql+ pymysql://username:password@server/db
1
the next operation is normal
Read More:
- Python problem: indenta tionError:expected an Error resolution of indented block
- In Python, import XXX does not report an error, but in IPython (Jupiter notebook)
- ThinkPad T400 fan error error report: an example of solving non fan problem
- The problem of failed to create process occurs in pyinstaller package program of Python
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- [leetcode] 926. Flip string to monotone increasing problem solving report (Python)
- Solve the problem that the version of less is too high
- Python module learning-Paramiko-Use python to throw an exception: Authentication failed.
- An idea to solve Warning move_uploaded_file, failed to open stream in the process of php uploading files
- Solve the problem of Python in Windows environment: Fatal error in launcher: Unable to create process using’”‘ in pip installation
- Can’t find Python executable “D:\python3\python.exe”, you can set the PYTHON env variable.
- Failed to execute tools\ android.bat : minutes! The same thing on the Internet, can’t it be solved? Look at this one!
- Pychar reported an error. Unable to set the python SDK in Python 3.8. This SDK appears to be invalid.
- Edit the file to be edited by gedit. After saving, a warning of Set document metadata failed: Setting attribute metadata::gedit-position no appears
- Solutions to the problem of turtle.terminator
- Unity package encountered an error report about gradle build failed
- Error starting ApplicationContext. To display the conditions report re run
- Idea2020.2 encountered pom.xml The problem of file error report in Maven plug-in tomcat7
- How to solve the problem of “please enter a commit message to explain why this merge is necessary” when git merges branches?
- Python — a solution to [error 24: too many open files] under Ubuntu