Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 没有名为';MySQLdb';安装mysqlclient之后_Python_Mysql_Module - Fatal编程技术网

Python 没有名为';MySQLdb';安装mysqlclient之后

Python 没有名为';MySQLdb';安装mysqlclient之后,python,mysql,module,Python,Mysql,Module,我正在使用PyCharm,我正在尝试制作一个连接到数据库的简单脚本 在PyCharm终端中,来自的两个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

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

在PyCharm终端中,来自的两个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
C:\Users\erics\CS261\venv\Scripts\python.exe C:/Users/erics/CS261/venv/Scripts/test.py
回溯(最近一次呼叫最后一次):
文件“C:/Users/erics/CS261/venv/Scripts/test.py”,第1行,在
导入MySQLdb
ModuleNotFoundError:没有名为“MySQLdb”的模块
进程已完成,退出代码为1

你好,埃里克!您使用的是什么版本的Python?你能试试上面给出的一些解决方案吗?hello@Ivanhercaz,我正在使用Python 3.8,我尝试了
pip安装mysqlclient
,但没有成功
MySQLdb/_mysql.c(29):致命错误C1083:无法打开包含文件:“mysql.h”:没有这样的文件或目录错误:命令“c:\\Program Files(x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe“失败,退出状态为2
Hi Eric!您使用的是什么版本的Python?你能试试上面给出的一些解决方案吗?hello@Ivanhercaz,我正在使用Python 3.8,我尝试了
pip安装mysqlclient
,但没有成功
MySQLdb/_mysql.c(29):致命错误C1083:无法打开包含文件:“mysql.h”:没有这样的文件或目录错误:命令“c:\\Program Files(x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe“失败,退出状态为2