我已经安装了sudo apt-get install python3-dev libmysqlclient-dev
,但仍然出现这样的错误。
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f8/9b/5db9a03e2088a87c26e3e4d4c7f7e8f4c2dbae610f9521cdfac15755a795/mysqlclient-1.4.5.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/ridho619/Desktop/Dev/Env/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-apajn0g3/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-apajn0g3/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-apajn0g3/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-apajn0g3/mysqlclient/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ridho619/Desktop/Dev/Env/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
from setuptools.dist import Distribution, Feature
File "/home/ridho619/Desktop/Dev/Env/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
from setuptools import windows_support
File "/home/ridho619/Desktop/Dev/Env/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
答案 0 :(得分:0)
您可以尝试以下命令吗?
sudo apt-get install libpython3.5-minimal
答案 1 :(得分:0)
我使用的是Ubuntu 18.04,发现此解决方案对python 3.7.5版很有用
第1步。通过终端安装“ libpython3.7-dev”
> sudo apt-get install libpython3.7-dev
第2步:在我的情况下,使用pip安装最新版本的'mysqlclient'1.4.6
> python3 -m pip install mysqlclient==1.4.6