[Fixed]-Error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient

38πŸ‘

βœ…

You need to install python-dev:

sudo apt-get install python-dev

And, since you are using python3:

sudo apt-get install python3-dev

This command should help you.

If you are using mac os you might try:

brew update && brew rm python3 && brew install python3

You need to brew has been installed already, otherwise you can install it. It is very useful for getting packages in Mac OS. http://brew.sh/

πŸ‘€Paul

32πŸ‘

For Ubuntu you also need to install build-essential

sudo apt-get install build-essential

11πŸ‘

For those using different versions, such as Python 3.5, 3.6 or 3.7 I found this:

Part I

For Python 2.x use:

  $ sudo apt-get install python-dev

For Python 2.7 use:

  $ sudo apt-get install libffi-dev

For Python 3.x use:

  $ sudo apt-get install python3-dev

For Python 3.4 use:

  $ sudo apt-get install python3.4-dev

For Python 3.7 use:

  $ sudo apt-get install python3.7-dev

Part II

If this still doesn’t help, others have pointed out to install

  $ sudo apt-get install build-essential

and finally

  $ sudo apt-get install libssl-dev

But the last two didn’t help me personally. Just in case, hope it helps you.

πŸ‘€david

5πŸ‘

For those using python3.5:

apt-get install python3.5-dev
wget https://bootstrap.pypa.io/get-pip.py
python3.5 get-pip.py
pip3.5 install mysqlclient
πŸ‘€Psddp

1πŸ‘

Tried all of the above suggestions and a few found elsewhere and nothing worked. In the end the solution was simple enough (courtesy of ignacionf on GitHub):

pip install git+https://github.com/PyMySQL/mysqlclient-python.git
πŸ‘€Caspar Fisher

Leave a comment