简体   繁体   English

麻烦在ubuntu18.04上安装mysqlclient

[英]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. 我正在尝试在ubuntu 18.04上为Django项目安装mysqlclient,但是在安装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. 您必须安装MySQL标头。

sudo apt install libmysqlclient-dev

(and stop using Python 2.7, it's out of support in a month) (并停止使用Python 2.7,它在一个月内就不再受支持)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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