在virtualenv中没有安装MySQL-python(EnvironmentError:找不到mysql_config)

时间:2015-09-02 10:03:57

标签: python mysql django virtualenv mysql-python

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

我创建了一个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的未满足的依赖关系(不确定)

Os:Ubuntu 14.04 LTS

非常感谢任何帮助。

修改:安装sudo apt-get install libmariadbclient-dev后,我可以毫无问题地安装MySQL-python(我不确定这可以作为答案添加)。

1 个答案:

答案 0 :(得分:0)

运行apt-cache policy libmysqlclient18&您会发现自libmysqlclient18的版本为mariadb。如果他们没有提供开发包,那么你将需要在没有开发包的情况下生活或者摆脱mariadb& amp;无论安装什么