我已在Ubuntu上安装mysqlclient的步骤:
python3 -m venv env
source env/bin/activate
sudo apt-get install python3.7-dev #or python3.8
sudo apt-get install libmysqlclient-dev
pip install django mysqlclient
但是,出现以下错误:
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/dastan/projects/crud_add_book/env/bin/python3 -u -c
"import setuptools,
> tokenize;__file__='/tmp/pip-build-a6zmf3am/mysqlclient/setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record /tmp/pip-eaynvhxp-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/dastan/projects/crud_add_book/env/include/site/python3.6/mysqlclient"
failed with error code 1 in /tmp/pip-build-a6zmf3am/mysqlclient/