No module named 'pymysql'

后端 未结 14 1731
清酒与你
清酒与你 2020-12-15 02:32

I\'m trying to use PyMySQL on Ubuntu.

I\'ve installed pymysql using both pip and pip3 but every time I use import pymysq

14条回答
  •  温柔的废话
    2020-12-15 03:06

    To get around the problem, find out where pymysql is installed.

    If for example it is installed in /usr/lib/python3.7/site-packages, add the following code above the import pymysql command:

    import sys
    sys.path.insert(0,"/usr/lib/python3.7/site-packages")
    import pymysql
    

    This ensures that your Python program can find where pymysql is installed.

提交回复
热议问题