Problem/Question:
After installing PyMySQL successfully, still getting an error while importing PyMySQL
C:\Users\usrname\AppData\Local\Programs\Python\Python36-32\Scripts>pip install
Collecting PyMySQL
Downloading PyMySQL-0.7.11-py2.py3-none-any.whl (78kB)
100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 81kB 327kB/s
Installing collected packages: PyMySQL
Successfully installed PyMySQL-0.7.11
C:\Users\usrname\AppData\Local\Programs\Python\Python36-32\Scripts>pip list
DEPRECATION: The default format will switch to columns in the future. You can us
pip (9.0.1)
PyMySQL (0.7.11)
pyqtgraph (0.10.0)
setuptools (28.8.0)
>>> import PyMySQL
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import PyMySQL
ModuleNotFoundError: No module named 'PyMySQL'
Fix/Answer:
Name of the import doesn't need to be the same as the project,
Use,
import pymysql
After installing PyMySQL successfully, still getting an error while importing PyMySQL
C:\Users\usrname\AppData\Local\Programs\Python\Python36-32\Scripts>pip install
Collecting PyMySQL
Downloading PyMySQL-0.7.11-py2.py3-none-any.whl (78kB)
100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 81kB 327kB/s
Installing collected packages: PyMySQL
Successfully installed PyMySQL-0.7.11
C:\Users\usrname\AppData\Local\Programs\Python\Python36-32\Scripts>pip list
DEPRECATION: The default format will switch to columns in the future. You can us
pip (9.0.1)
PyMySQL (0.7.11)
pyqtgraph (0.10.0)
setuptools (28.8.0)
>>> import PyMySQL
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import PyMySQL
ModuleNotFoundError: No module named 'PyMySQL'
Fix/Answer:
Name of the import doesn't need to be the same as the project,
Use,
import pymysql
No comments:
Post a Comment