繁体   English   中英

为什么我从 django 中的需求文件安装 package 时出错

[英]why i am getting error while installing package from requirement file in django

Hi Everyone i have clone my django project on ubuntu machine(22.04.1 LTS) python version is- 3.8.10 and django version is 2.2 while installing packages using cmd pip install -r requirements.txt then after installing some packages i got error,据我所知,这是 mysqlclient 错误

注意-mysql db 工作正常。

请帮帮我。

错误

Collecting mysqlclient==2.0.3
  Using cached mysqlclient-2.0.3.tar.gz (88 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      /bin/sh: 1: mysql_config: not found
      /bin/sh: 1: mariadb_config: not found
      /bin/sh: 1: mysql_config: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup.py", line 15, in <module>
          metadata, options = get_config()
        File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

要么mysql_config不在您的 PATH 中,要么没有安装。
尝试使用which mysql_config找到它,如果找到,请将其路径添加到您的 PATH 中。
否则,安装libmysqlclient-dev
假设您使用的是 Ubuntu 使用: sudo apt -y install libmysqlclient-dev
之后尝试再次安装要求。

暂无
暂无

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

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