问答详情
源自:4-2 查询MySQL数据

pymysql已安装,但是使用时报错请问是什么问题?

E:\PrograFiles\python-3.5\python.exe F:/AG-Data/Space-Python/Code/imooc/wikitomysql.py

Traceback (most recent call last):

  File "F:/AG-Data/Space-Python/Code/imooc/wikitomysql.py", line 7, in <module>

    import pymysql.cursors

ImportError: No module named 'pymysql.cursors'; 'pymysql' is not a package


提问者:SunYuJieBJ 2016-08-29 12:35

个回答

  • 秋名山车神
    2016-08-29 17:24:51
    已采纳

    在python命令行的交互环境,输入 import pymysql.cursors 会报错吗?

    http://img.mukewang.com/57c3ff600001a11e02640079.jpg

  • 新飞梦
    2018-01-29 00:21:28

    pymysql安装不成功,有安装成功的吗


  • SunYuJieBJ
    2016-08-29 15:43:48

    打开后是这样的

    E:\PrograFiles\python-3.5\python.exe F:/AG-Data/Space-Python/Code/imooc/wikitomysql.py

    Traceback (most recent call last):

    Open main menu <----> https://en.m.wikipedia.org//wiki/Special:MobileMenu

      File "F:/AG-Data/Space-Python/Code/imooc/wikitomysql.py", line 18, in <module>

        connection = pymysql.connect(host='localhost',

    AttributeError: module 'pymysql' has no attribute 'connect'


  • 辰_ger
    2016-08-29 15:19:33

    直接import pymysql