django从sqlite切换到mysql时总是提示No module named 'MySQLdb'
2017-04-23 17:31
295 查看
python版本:python3.4
python2和python3有太多不兼容的地方,用着就是操蛋
本来是安装了mysqldb的, 结果配置了数据库后运行总是报错:
'Did you install mysqlclient or MySQL-python?' % e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?
真是抓狂...........
后来查资料,说是python3.4里面,使用原来python2.7的mysqldb已经不能连接mysql数据库了,要使用pymysql,来完成连接mysql的重任,可是我pip安装了PyMySQL,还是报错,真是无语了。。。。
后来看到一篇文章,http://www.jianshu.com/p/82781add8449
在站点的
python2和python3有太多不兼容的地方,用着就是操蛋
本来是安装了mysqldb的, 结果配置了数据库后运行总是报错:
'Did you install mysqlclient or MySQL-python?' % e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?
真是抓狂...........
后来查资料,说是python3.4里面,使用原来python2.7的mysqldb已经不能连接mysql数据库了,要使用pymysql,来完成连接mysql的重任,可是我pip安装了PyMySQL,还是报错,真是无语了。。。。
后来看到一篇文章,http://www.jianshu.com/p/82781add8449
在站点的
__init__.py文件中添加
import pymysql pymysql.install_as_MySQLdb()搞定了,可以继续了!
相关文章推荐
- su切换用户总是提示密码错误
- 安装MySQL5.6新建用户并创建密码时总是提示密码不符合要求:ERROR 1819 (HY000): Your password does NOT satisfy the CURRENT ……
- Django学习:今天测试MySQL连接的时候提示Unknown command: 'syncdb'
- c# 引用 MySQL使用基于Parameter方式代码,总是提示:“Column '列名' cannot be null”
- Typecho SQLite与MySQL的数据库切换及解决MySQL连接打开缓慢问题
- No module named 'MySQLdb' python3.6 + django 1.10 + mysql 无法连接
- 在SQLite中创建数据库时总是提示错误?
- 重装mysql安装最后一项的apply security settings 总是不能进行。提示error nr.1045然后就是access denied for user 'root' @'loca
- django sqlite3迁移到mysql
- centos,linux下django 链接mysql提示mysql.sock无法打开问题
- 重装mysql安装最后一项的apply security settings 总是不能进行。提示error nr.1045然后就是access denied for user 'root' @'loc
- 引用 MySQL使用基于Parameter方式代码,总是提示:“Column '列名' cannot be null”
- 【解决】Django项目废弃SQLite3拥抱MySQL
- MySql中存储过程中的@变量总是无法执行,提示Parameter '@XXX' must be defined
- django数据库迁移相关【sqlite3迁移到MySQL】(django2.0.3测试通过)
- Django基础 - 修改默认SQLite3数据库连接为MySQL
- django 10.5 sqlite3迁移到mysql
- 编译安装PDO_MYSQL拓展模块,总是提示No such file or directory
- 关于mysql总是提示没有权限进入问题
- mysql在进入mysql工具时,总是有错误提示: