No module named ‘aiomysql’

D:\python3-webapp-Su\www>python modelTest.py
Traceback (most recent call last):
  File "modelTest.py", line 6, in <module>
    import orm
  File "D:\python3-webapp-Su\www\orm.py", line 6, in <module>
    import aiomysql
ModuleNotFoundError: No module named 'aiomysql'
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

查看当前是否安装 pip freeze

D:\python3-webapp-Su\www>pip freeze
aiohttp==2.3.6
alabaster==0.7.10
anaconda-client==1.6.5
anaconda-navigator==1.6.9
anaconda-project==0.8.0
asn1crypto==0.22.0
astroid==1.5.3
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

发现没安装,安装即可

安装 pip install aiomysql,这里不要使用 pip3 install aiomysql

D:\python3-webapp-Su\www>pip install aiomysql
Collecting aiomysql
  Using cached aiomysql-0.0.11.tar.gz
Collecting PyMySQL>=0.7.5 (from aiomysql)
  Using cached PyMySQL-0.8.0-py2.py3-none-any.whl
Building wheels for collected packages: aiomysql
  Running setup.py bdist_wheel for aiomysql ... done
  Stored in directory: C:\Users\admin\AppData\Local\pip\Cache\wheels\fc\a3\fa\8a329c1135f654f37f37fe7db9c4608413fa73a966d919009d
Successfully built aiomysql
Installing collected packages: PyMySQL, aiomysql
Successfully installed PyMySQL-0.8.0 aiomysql-0.0.11
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

aiomysql==0.0.11 安装完成

D:\python3-webapp-Su\www>pip freeze
aiohttp==2.3.6
aiomysql==0.0.11
alabaster==0.7.10
anaconda-client==1.6.5
anaconda-navigator==1.6.9
anaconda-project==0.8.0
asn1crypto==0.22.0
astroid==1.5.3
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9