python报错:cannot import name 'connector' from 'mysql'

 G:\junlun\python\test> python .\mysql.py
Traceback (most recent call last):
  File ".\mysql.py", line 1, in
    from  mysql import connector
  File "G:\junlun\python\test\mysql.py", line 1, in
    from  mysql import connector
ImportError: cannot import name 'connector' from 'mysql' (G:\junlun\python\test\mysql.py)

是因为python文件命名为mysql.py导致占用系统包的名字,切记文件命名要注意不能和系统包名相同

你可能感兴趣的:(python)