安装mysqlclient后没有名为“MySQLdb”的模块

2024-09-30 04:37:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用PyCharm,我正在尝试制作一个连接到数据库的简单脚本

在PyCharm终端中,来自here的两个mysqlclient安装似乎都失败了

(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
mysqlclient-1.4.6-cp38-cp38-win32.whl is not a supported wheel on this platform.

在Windows的终端中,它们已成功安装:

C:\Users\erics>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
Processing c:\users\erics\mysqlclient-1.4.6-cp38-cp38-win32.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

即使它是“成功安装”,我的脚本似乎没有运行

C:\Users\erics\CS261\venv\Scripts\python.exe C:/Users/erics/CS261/venv/Scripts/test.py
Traceback (most recent call last):
  File "C:/Users/erics/CS261/venv/Scripts/test.py", line 1, in <module>
    import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'

Process finished with exit code 1

Tags: installpip脚本终端venvscriptswinusers

热门问题