繁体   English   中英

Ubuntu 18.04 和 python3.8 上的错误“pip install mysqlclient”

[英]ERROR 'pip install mysqlclient' on Ubuntu 18.04 and python3.8

我已经安装了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.

您可以尝试以下命令:

sudo apt-get install libpython3.5-minimal

我正在使用 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

暂无
暂无

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

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