安装MySQL-python问题
Tofloor
poster avatar
zhaojun_mail
deepin
2019-11-01 20:55
Author
sudo pip install MySQL-python
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting MySQL-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-XXhuwn/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-XXhuwn/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-XXhuwn/MySQL-python/pip-egg-info
         cwd: /tmp/pip-install-XXhuwn/MySQL-python/
    Complete output (10 lines):
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "", line 1, in
      File "/tmp/pip-install-XXhuwn/MySQL-python/setup.py", line 17, in         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
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我已经安装了mysql数据库服务并且可以访问。但是安装python的mysql模块报错,这个问题怎么解决呢?

网上查有人说要先安装libmysqlclient-dev。但是提示没有可选包
sudo apt-get install libmysqlclient-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树      
正在读取状态信息... 完成      
没有可用的软件包 libmysqlclient-dev,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到

E: 软件包 libmysqlclient-dev 没有可安装候选




Reply Favorite View the author
All Replies
avatar
ghostry
deepin
2019-11-01 22:02
#1
测试环境建议使用沙盒,

搞乱系统有点不值.

比如
https://cloud.docker.com/repository/docker/ghostry/python-work
Reply View the author
avatar
Feng Yu
deepin
2019-11-02 00:35
#2
sudo apt install -y python-mysql.connector

如果你没有瞎搞系统环境的python的话,这个还能用。

如需使用系统的python3环境,则sudo apt install -y python3-mysql.connector
Reply View the author