简体   繁体   中英

trouble install mysqlclient on ubuntu18.04

I am trying to install mysqlclient on ubuntu 18.04 for a Django project but having problem installing mysql. Here is the information from the terminal:

pip install mysqlclient

Collecting mysqlclient

      ----------------------------------------
      Failed building wheel for mysqlclient
      Running setup.py clean for mysqlclient
2.7/MySQLdb/constants
        running build_ext
        building 'MySQLdb._mysql' extension
        creating build/temp.linux-x86_64-2.7
        creating build/temp.linux-x86_64-2.7/MySQLdb
        x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -
    Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/opt/lampp/include/mysql -I/opt/lampp/include/mysql/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
        MySQLdb/_mysql.c:29:10: fatal error: mysql.h: No such file or directory`enter code here`
         #include "mysql.h"
                  ^~~~~~~~~
        compilation terminated.
        error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

You'll have to install the MySQL headers.

sudo apt install libmysqlclient-dev

(and stop using Python 2.7, it's out of support in a month)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM