pip install mysql-python fails with EnvironmentError: mysql_config not found

后端 未结 21 2614
广开言路
广开言路 2020-11-22 15:58

This is the error I get

(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Do         


        
21条回答
  •  被撕碎了的回忆
    2020-11-22 16:09

    sometimes the error depends on the actual cause. we had a case where mysql-python was installed through the python-mysqldb debian package.

    a developer who didn't know this, accidentally ran pip uninstall mysql-python and then failed to recover with pip install mysql-python giving the above error.

    pip uninstall mysql-python had destroyed the debian package contents, and of course pip install mysql-python failed because the debian package didn't need any dev files.

    the correct solution in that case was apt-get install --reinstall python-mysqldb which restored mysql-python to its original state.

提交回复
热议问题