繁体   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