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

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

Python开发 lixian 2年前 (2023-02-22) 11704次浏览 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. panelvan kiralama
    MURAT2023-05-27 02:10
  2. En uygun fiyata aylık yıllık k1 belgeli panelvan araç kiralama sitesi
    SİNEM2023-05-24 09:20
  3. IQOS Heets Marketi
  4. aramalarım sonunda buraya geldim ve kesinlikle işime yarayan bir makale oldu. teşekkür ederim
  5. very informative articles or reviews at this time.
  6. web sitesi yaptırmak
  7. Hocam detaylı bir anlatım olmuş eline sağlık
  8. There is definately a lot to find out about this subject. I like all the points you made
  9. Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
  10. stressthem
  11. 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.
  12. very informative articles or reviews at this time.
  13. Yazınız için teşekkürler. Bu bilgiler ışığında nice insanlar bilgilenmiş olacaktır.
  14. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
  15. I just like the helpful information you provide in your articles
  16. Nice post. I learn something totally new and challenging on websites
  17. Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
  18. This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
  19. Nice post. I learn something totally new and challenging on websites
  20. Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.