簡體   English   中英

Pip 安裝 mariadb mac

[英]Pip install mariadb mac

I'm wanting to connect to a MariaDB database for a web app via Python but can't seem to install the mariadb package. 我正在使用 Python 3.7.9 運行 Mac。 這是我嘗試運行pip install mariadb時得到的結果:

Collecting mariadb
  Using cached mariadb-1.0.11.zip (85 kB)
Using legacy setup.py install for mariadb, since package 'wheel' is not installed.
Installing collected packages: mariadb
    Running setup.py install for mariadb ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/.../bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-install-yeefaepy/mariadb/setup.py'"'"'; __file__='"'"'/private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-install-yeefaepy/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-record-ock6ntv0/install-record.txt --single-version-externally-managed --compile --install-headers /Users/.../include/site/python3.7/mariadb
         cwd: /private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-install-yeefaepy/mariadb/
    Complete output (46 lines):
    10.6.8
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/mariadb
    copying mariadb/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb
    creating build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    copying mariadb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    copying mariadb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    copying mariadb/constants/INDICATOR.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    copying mariadb/constants/CURSOR.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    copying mariadb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.7/mariadb/constants
    running build_ext
    building 'mariadb._mariadb' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/mariadb
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/.../include -arch x86_64 -I/Users/MitchPudill/opt/anaconda3/include -arch x86_64 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/local/Cellar/mariadb-connector-c/3.3.1/include/mariadb -I/usr/local/Cellar/mariadb-connector-c/3.3.1/include/mariadb/mysql -I./include -I/Users/.../include -I/Users/.../opt/anaconda3/include/python3.7m -c mariadb/mariadb.c -o build/temp.macosx-10.9-x86_64-3.7/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/local/Cellar/mariadb-connector-c/3.3.1/lib/mariadb/plugin"
    In file included from mariadb/mariadb.c:21:
    ./include/mariadb_python.h:75:2: error: Minimum required version of MariaDB Connector/C is 3.1.3
    #error Minimum required version of MariaDB Connector/C is 3.1.3
     ^
    ./include/mariadb_python.h:244:30: error: field has incomplete type 'enum enum_indicator_type'
        enum enum_indicator_type indicator;
                                 ^
    ./include/mariadb_python.h:244:10: note: forward declaration of 'enum enum_indicator_type'
        enum enum_indicator_type indicator;
             ^
    ./include/mariadb_python.h:297:5: error: unknown type name 'ps_field_fetch_func'
        ps_field_fetch_func func;
        ^
    mariadb/mariadb.c:273:45: error: use of undeclared identifier 'STMT_INDICATOR_NULL'
                           MrdbIndicator_Object(STMT_INDICATOR_NULL));
                                                ^
    mariadb/mariadb.c:275:45: error: use of undeclared identifier 'STMT_INDICATOR_DEFAULT'
                           MrdbIndicator_Object(STMT_INDICATOR_DEFAULT));
                                                ^
    mariadb/mariadb.c:277:45: error: use of undeclared identifier 'STMT_INDICATOR_IGNORE'
                           MrdbIndicator_Object(STMT_INDICATOR_IGNORE));
                                                ^
    mariadb/mariadb.c:279:45: error: use of undeclared identifier 'STMT_INDICATOR_IGNORE_ROW'
                           MrdbIndicator_Object(STMT_INDICATOR_IGNORE_ROW));
                                                ^
    7 errors generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/.../bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-install-yeefaepy/mariadb/setup.py'"'"'; __file__='"'"'/private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-install-yeefaepy/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/yz/_pkhkb0x2xb233lq1n0v193r0000gp/T/pip-record-ock6ntv0/install-record.txt --single-version-externally-managed --compile --install-headers /Users/.../include/site/python3.7/mariadb Check the logs for full command output.

我試過的:

  1. 新的虛擬環境(同樣的問題)
  2. 不同的 Python 版本(相同問題)
  3. brew install mariadb-connector-c ( mariadb-connector-c 3.3.1 is already installed and up-to-date )
  4. brew install No available formula with the name "libmariadb3" brew install libmariadb-dev & brew install libmariadb3 No available formula with the name "libmariadb-dev"
  5. brew install mariadb :安裝但不解決問題
  6. 安裝不同但仍然相對較新的mariadb版本:可以,但不能解決問題
  7. 取消鏈接mariadb並鏈接mariadb-connector-c :可以做到但不能解決問題

我可能在兔子洞的某個地方嘗試了更多的東西。 歡迎任何建議。 謝謝。

如果您的 XCode 命令行已過期,則重新鏈接 mariadb 連接器-c 與否無關緊要。 我無法使用:python 3.7、3.8、3.9 或最新的 3.10 版本。 [僅作記錄,我在我的安裝中使用 pyenv 支持幾個 python 版本]

前往 AppStore 並在 XCode 上進行升級修復了該問題。 之后,成功安裝:

pip install mariadb

進入所有上述 python 版本,完全沒有問題。 有趣的是,我在 MariaDB 文檔/要求中找不到任何建議。 究竟是什么阻止了 pip 的安裝,我仍然不知道。

希望這將幫助某人避免一些頭痛。

暫無
暫無

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

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