• 欢迎访问显哥博客,本网站纯属学习技术,绝无商业用途,欢迎小伙伴们共同学习!研究技术!QQ:52249909 加我QQ
  • 世界75亿人,这么小的概率,能认识你,是我一生的幸运,不妨加个QQ接触一下:52249909 加我QQ

Mysqldb不兼容Python3.5 以后的版本 报错NameError: name ‘_mysql’ is not defined【显哥出品,必为精品】

Python开发 lixian 1年前 (2023-02-22) 6794次浏览 98个评论 扫描二维码
文章目录[隐藏]

Mysqldb不兼容Python3.5 以后的版本 报错NameError: name '_mysql' is not defined【显哥出品,必为精品】

解决办法:

1、打开环境下Python\Lib\site-packages\MySQLdb\release.py 、查看mysqlclient的版本

Mysqldb不兼容Python3.5 以后的版本 报错NameError: name '_mysql' is not defined【显哥出品,必为精品】

2、在项目下的init.py文件内,加上如下代码(注意是在自己的项目内):

import pymysql

pymysql.version_info = (1,4,6,'final',0)

pymysql.install_as_MySQLdb()

本站博主 , 版权所有丨如未注明 , 均为原创
转载请注明原文链接:Mysqldb不兼容Python3.5 以后的版本 报错NameError: name ‘_mysql’ is not defined【显哥出品,必为精品】
喜欢 (0)

您必须 登录 才能发表评论!

(98)个小伙伴在吐槽
  1. Hocam detaylı bir anlatım olmuş eline sağlık
  2. su kaçağı tespiti için doğru adres kırmadan dökmeden kaçak tespiti.
  3. I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will
  4. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
  5. I do not even understand how I ended up here, but I assumed this publish used to be great
  6. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
  7. I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.
  8. This is my first time pay a quick visit at here and i am really happy to read everthing at one place
  9. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
  10. very informative articles or reviews at this time.
  11. I do not even understand how I ended up here, but I assumed this publish used to be great
  12. very informative articles or reviews at this time.
  13. I just like the helpful information you provide in your articles
  14. I do not even understand how I ended up here, but I assumed this publish used to be great
  15. I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.
  16. For the reason that the admin of this site is working, no uncertainty very quickly it will be renowned, due to its quality contents.
  17. Pretty! This has been a really wonderful post. Many thanks for providing these details.
  18. There is definately a lot to find out about this subject. I like all the points you made
1345