error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient

若如初见. 提交于 2019-11-30 05:12:17

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/

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

For Ubuntu you also need to install build-essential

sudo apt-get install build-essential

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!