pip install mariadb の問題 - mariadb_config が見つかりません 質問する

pip install mariadb の問題 - mariadb_config が見つかりません 質問する

pip3 install mariadbUbuntu 18.04 を実行している Raspberry Pi で実行しようとしましたが、失敗しました。

他の回答で提案されているように、次のパッケージをインストールしてみました。

sudo apt-get install mariadb-server
sudo apt-get install libmariadbclient-dev
sudo apt-get install libmysqlclient-dev

pip3 install mysqlclient
pip3 install mysql-connector-python-rf

しかし、私はまだ次のような問題に直面しています:

ubuntu@ubuntu:~$ pip3 install mariadb
Collecting mariadb
  Using cached https://files.pythonhosted.org/packages/8f/c9/7050899dc1066409a17e1147d3afe1b078e582afdb755c6d3cb9c9a5c3ab/mariadb-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mariadb_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-2gdw_t_r/mariadb/setup.py", line 26, in <module>
        cfg = get_config(options)
      File "/tmp/pip-build-2gdw_t_r/mariadb/mariadb_posix.py", line 49, in get_config
        cc_version = mariadb_config(config_prg, "cc_version")
      File "/tmp/pip-build-2gdw_t_r/mariadb/mariadb_posix.py", line 27, in mariadb_config
        "mariadb_config not found.\nPlease make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config'\noption, which should point to the mariadb_config utility.")
    OSError: mariadb_config not found.
    Please make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config'
    option, which should point to the mariadb_config utility.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2gdw_t_r/mariadb/

ファイルがあります/etc/mysql/my.cnf

ベストアンサー1

おそらく、MariaDB データベース開発ファイルをインストールする必要があります。https://packages.debian.org/unstable/libmariadb-dev. Python コネクタを Linux で正しく動作させるには、このパッケージが必要です。次の手順に従う必要があります。

  1. sudo apt-get update -y
  2. sudo apt-get install -y libmariadb-dev
  3. pip3 install mariadb

ここでは、まず、システムのアップグレードが必要なパッケージのリストを更新します。次に、前述の開発ライブラリをインストールします。最後のステップは、pip3 を使用して mariadb をインストールすることです。これで、期待どおりに動作するはずです。

おすすめ記事