PyCharm imports the pymysql package to run the error and solve the problem: No module named 'PyMySQL'

import pymysql    #import package

#Error reporting problem shows: 
ImportError: No module named ' PyMySQL '

The error message appears: The package name cannot be found.

The solution is as follows:

①Download the PyMySQL package first, and execute the command in the terminal:

sudo pip install PyMySQL

 

②PyMySQL under pip is as follows:

pip install PyMySQL

Requirement already satisfied (use --upgrade to upgrade): PyMySQL in /usr/local/lib/python2.7/dist-packages

 

③ Import and install:

sudo apt-get install python3-pymysql

After the installation is complete, you can import~

import PyMySQL
print("Here")

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325326203&siteId=291194637