Mysql AttributeError: module 'MySQLdb' has no attribute 'connect'报错原因以及解决方法

版权声明:大家一起学习,欢迎转载,转载请注明出处。若有问题,欢迎纠正! https://blog.csdn.net/memory_qianxiao/article/details/82107657

整个暑假都在弄爬虫,想做个完整的项目,重新学习大二上学期的Mysql数据库,用python运行MySQL库的时候报错:AttributeError: module 'MySQLdb' has no attribute 'connect'

原因:因为.py文件和库的名字一样,会报错

解决方法:命名py脚本时,不要与python预留字,模块名等相同

猜你喜欢

转载自blog.csdn.net/memory_qianxiao/article/details/82107657