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

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

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

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)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到
(12)个小伙伴在吐槽
  1. takipçi satın aldım süper
    instagram takipçi arttırma2023-03-31 20:28 (1天前)回复
  2. the world of crypto money
    kripto para dünyası2023-03-30 11:07 (3天前)回复
  3. Hackdra is a cyber security company that can provide smart contract auditing, pen-testing, bug bounty, blockchain, web3, and ARM services with AI.
    hackdra2023-03-14 23:29 回复
  4. Social Media Panel
    smm paneli2023-03-14 09:04 回复
  5. We are dedicated to serving a wide range of users, from 7 to 70, who care about their body and beauty.
    lip filler bruising2023-03-13 00:58 回复
  6. How to find love ?
    disfruto2023-03-12 04:14 回复
  7. Rising up on social media is just a click away from you.
    smm paneli2023-03-11 19:54 回复
  8. I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will
    ucuz takipçi2023-03-06 20:06 回复
  9. 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!
  10. I very delighted to find this internet site on bing, just what I was searching for as well saved to fav
  11. 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.
  12. very informative articles or reviews at this time.
    ucuz takipçi2023-03-03 21:50 回复