未在virtualenv中安装MySQL python(环境错误:未找到MySQL\u配置)

未在virtualenv中安装MySQL python(环境错误:未找到MySQL\u配置),python,mysql,django,virtualenv,mysql-python,Python,Mysql,Django,Virtualenv,Mysql Python,我正在构建一个django项目,它需要mysql作为后端 我创建了一个virtualenv,并尝试使用pip安装MySQL-python pip install MySQL-python Downloading/unpacking MySQL-python==1.2.5 Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded Running setup.py (path:/home/sayone/virtual/m

我正在构建一个django项目,它需要mysql作为后端

我创建了一个virtualenv,并尝试使用pip安装MySQL-python

pip install MySQL-python
    Downloading/unpacking MySQL-python==1.2.5
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/home/sayone/virtual/myvinotype/build/MySQL-python/setup.py) egg_info for package MySQL-python
    sh: 1: mysql_config: not found
........
EnvironmentError: mysql_config not found
通过搜索,我发现我需要安装libmysqlclient-dev

sudo apt-get install libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.44-0ubuntu0.14.04.1) but 10.0.21+maria-1~trusty is to be installed
E: Unable to correct problems, you have held broken packages.
要安装
MySQL-python
,我们需要安装
libmysqlclient-dev
,但它最终与mariadb存在未满足的依赖关系(不确定)

操作系统:Ubuntu 14.04 LTS

非常感谢您的帮助


编辑:安装
sudo apt get install libmariadbclient dev
后,我能够安装
MySQL-python
而没有任何问题(我不确定这是否可以作为答案添加)。如果他们没有提供开发包,那么您将需要离开开发包,或者摆脱mariadb&不管它安装了什么

如果您使用的是python 3.4版,我建议您切换回2.7版。安装mysql时,版本3.4中存在问题。@MuhammadShoaib建议使用
mysqlclient
而不是
mysql-python
。它适用于Python 3.3+,所以没有必要降级到2.7。@MuhammadShoaib我正在使用python 2.7apt-cache策略libmysqlclient18 libmysqlclient18:Installed:10.0.21+maria-1~ trusty Candidate:10.0.21+maria-1~ trusty Version表:**10.0.21+maria-1~ trusty 0 500 trusty/main amd64 Packages 100/var/lib/dpkg/status5.5.44-0ubuntu0.14.04.1 0 500可信更新/main amd64 Packages 500可信安全/main amd64 Packages 500可信安全/main amd64 Packages 5.5.35+dfsg-1ubuntu1 0 500可信/main amd64Ajay Gupta我没有完全明白我应该做什么,请在上面的评论中找到apt缓存策略libmysqlclient18的结果。但是在
sudo apt获得install libmariadbclient dev
之后,我就可以安装
MySQL-python
了,没有任何问题。