ubuntu 无法安装apache-airflow-providers-mysql:pkg-config错误

ylamdve6  于 2023-11-17  发布在  Apache
关注(0)|答案(3)|浏览(205)

我正在使用Debian/Ubuntu,我试图在我的Python虚拟环境中安装Airflow提供程序:

$ pip install apache-airflow-providers-mysql
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
      Traceback (most recent call last):
        File "/home/user/airflow/airflow_env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/user/airflow/airflow_env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/user/airflow/airflow_env/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-a5nk1xf1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-a5nk1xf1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-a5nk1xf1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 154, in <module>
        File "<string>", line 48, in get_config_posix
        File "<string>", line 27, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

字符串
我希望看到mysql提供者在气流连接下拉。

mec1mxoz

mec1mxoz1#

手动指定MYSQLCLIENT_CFLAGS和MYSQLCLIENT_LDFLAGS环境变量,请执行以下步骤:
1.打开终端窗口。
1.确定MySQL头文件和库的位置。这些位置可能因MySQL安装而异。您可以使用mysql_config命令检索此信息。运行以下命令查找头文件的位置:mysql_config --cflags运行以下命令查找库的位置:mysql_config --libs记下这些命令的输出,因为在接下来的步骤中您将需要它们。
1.设置MYSQLCLIENT_CFLAGS环境变量。将替换为从`mysql_config --cflags`命令获得的路径。运行以下命令:`export MYSQLCLIENT_CFLAGS="-I"` 1.设置MYSQLCLIENT_LDFLAGS环境变量。将替换为从mysql_config --libs命令获得的路径。运行以下命令:export MYSQLCLIENT_LDFLAGS="-L"注意:如果您的MySQL安装包含多个库,请用空格分隔每个库路径。
1.现在,当您安装需要MySQL客户端库的包时,例如Django的mysqlclient,构建过程将使用指定的CFLAGS和LDFLAGS值来定位必要的文件。您可以继续安装包或Django设置,指定的环境变量将用于定位MySQL客户端库。
通过手动设置MYSQLCLIENT_CFLAGS和MYSQLCLIENT_LDFLAGS环境变量,可以确保在安装或编译过程中使用正确的MySQL头文件和库。
我用这个方法解决了和你一样的问题

eqqqjvef

eqqqjvef2#

我的电脑是MacBook,

brew install mysql

字符串
能解决

tquggr8v

tquggr8v3#

pkg-config: not found是问题和解决方案的主要提示-您缺少构建工具,需要安装它们。

apt-get install pkg-config build-essential libmysqlclient-dev

字符串

相关问题