简体   繁体   中英

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, as per me this is mysqlclient error

Note-mysql db working fine.

please help me out.

Error

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.

It's either that mysql_config isn't in your PATH or it's not installed.
Try locating it using which mysql_config and if it's found add its path to your PATH.
Otherwise, intall libmysqlclient-dev .
Assuming you're on Ubuntu use: sudo apt -y install libmysqlclient-dev .
After that try installing the requirements again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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