簡體   English   中英

MySQL pip3 安裝錯誤:元數據生成失敗

[英]MySQL pip3 install error: metadata-generation-failed

我嘗試更新 pip 並安裝不同的軟件包,但似乎沒有任何效果。 我不確定我是否必須在 konsole 或 alacritty 中運行命令,但我們將不勝感激。 我用fedora順便說一句

 sh-5.1$ pip3 install mysql
 Defaulting to user installation because normal site-packages is not writeable
 Collecting mysql
 Using cached mysql-0.0.3-py3-none-any.whl (1.2 kB)
 Collecting mysqlclient
 Using cached mysqlclient-2.1.1.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: line 1: mysql_config: command not found
  /bin/sh: line 1: mariadb_config: command not found
  /bin/sh: line 1: mysql_config: command 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-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17    /
  setup.py", line 15, in <module>
      metadata, options = get_config()
    File "/tmp/pip-install-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17 
  /setup_posix.py", line 70, in get_config
      libs = mysql_config("libs")
    File "/tmp/pip-install-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17  
  /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.

在安裝之前,您必須解決依賴關系。

sudo apt-get install python3-dev libmysqlclient-dev

然后在虛擬環境中:

pip3 install mysqlclient

然后

  pip3 install mysql

它應該工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM