用Python连接MySQL
我试图用python连接mysql。我使用了命令“sudo pip install mysql python”和收到的消息用Python连接MySQL,python,mysql,Python,Mysql,我试图用python连接mysql。我使用了命令“sudo pip install mysql python”和收到的消息 Collecting mysql-python Downloading MySQL-python-1.2.5.zip (108kB) 100% |████████████████████████████████| 110kB 1.4MB/s Complete output from command python setup.py egg_info:
Collecting mysql-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 110kB 1.4MB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/tmp/pip-build-EdaCnd/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-EdaCnd/mysql-python
收集mysql-python
下载MySQL-python-1.2.5.zip(108kB)
100% |████████████████████████████████| 110kB 1.4MB/s
从命令python setup.py egg_info完成输出:
sh:mysql\u config:未找到命令
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/private/tmp/pip build EdaCnd/mysql python/setup.py”,第17行,在
元数据,options=get_config()
文件“setup_posix.py”,第43行,在get_config中
libs=mysql\u config(“libs\u r”)
mysql\u config中的文件“setup\u posix.py”,第25行
raise环境错误(“%s未找到”%)(mysql\u config.path,)
环境错误:未找到mysql\u配置
----------------------------------------
命令“python setup.py egg_info”在/private/tmp/pip build EdaCnd/mysql python中失败,错误代码为1
如何解决此问题?您需要安装mysql\u config。在Debian/Ubuntu上,您可以使用以下命令进行安装:
sudo apt-get install libmysqlclient-dev
假设您在计算机上具有管理员权限。也可能是mysql_配置不在您的路径中,您也应该对此进行调查。
sudo apt get install libmysqlclient dev
请先安装此配置。谢谢。这样做之后,我得到了消息“sudo:apt get:command not found”,您使用的是什么操作系统?