mysql_config not found when installing mysqldb python interface

前端 未结 30 1432
暗喜
暗喜 2020-11-22 06:56

I am trying to get a Python script to run on the linux server I\'m connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to i

相关标签:
30条回答
  • 2020-11-22 07:32

    You need to install the python-dev package:

    sudo apt-get install python-dev
    
    0 讨论(0)
  • 2020-11-22 07:33

    Step1:-Install Python3 & Python3-dev Both

    sudo apt-get install python3 python3-dev
    

    Step2:- Install Python & Mysql Connector

    sudo apt-get install libmysqlclient-dev
    

    step3:- Install python mysql client

    sudo apt-get install mysqlclient
    

    This will Solve your Problem

    0 讨论(0)
  • 2020-11-22 07:36

    The MySQL-python package is using the mysql_config command to learn about the mysql configuration on your host. Your host does not have the mysql_config command.

    The MySQL development libraries package (MySQL-devel-xxx) from dev.mysql.com provides this command and the libraries needed by the MySQL-python package. The MySQL-devel packages are found in the download - community server area. The MySQL development library package names start with MySQL-devel and vary based MySQL version and linux platform (e.g. MySQL-devel-5.5.24-1.linux2.6.x86_64.rpm.)

    Note that you do not need to install mysql server.

    0 讨论(0)
  • 2020-11-22 07:36

    On my Fedora 23 machine I had to run the following:

    sudo dnf install mysql-devel
    
    0 讨论(0)
  • 2020-11-22 07:37

    For Alpine Linux:

    $ apk add mariadb-dev mariadb-client mariadb-libs

    MariaDB is a drop-in replacement for MySQL and became the new standard as of Alpine 3.2. See https://bugs.alpinelinux.org/issues/4264

    0 讨论(0)
  • 2020-11-22 07:37

    I had the same problem. I solved it by following this tutorial to install Python with python3-dev on Ubuntu 16.04:

    sudo apt-get update
    sudo apt-get -y upgrade
    sudo apt-get install -y python3-pip
    sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
    

    And now you can set up your virtual environment:

    sudo apt-get install -y python3-venv
    pyvenv my_env
    source my_env/bin/activate
    
    0 讨论(0)
提交回复
热议问题