簡體   English   中英

在 Mac 上安裝 MySQL 客戶端時遇到問題

[英]Trouble installing MySQL client on Mac

 Using cached mysqlclient-1.3.0.tar.gz (76 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/mr.sallam/.local/share/virtualenvs/Admission_System-h6ReVRNX/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/setup.py'"'"'; __file__='"'"'/private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-pip-egg-info-186pdzul
         cwd: /private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/
    Complete output (10 lines):
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/setup_posix.py", line 47, in get_config
        libs = mysql_config("libs_r")
      File "/private/var/folders/58/khmzr9l90hx237729cjz2ct00000gn/T/pip-install-cn6qvsqm/mysqlclient_c82e6a9eeefe4d66bf9960f11336d0db/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6a/91/bdfe808fb5dc99a5f65833b370818161b77ef6d1e19b488e4c146ab615aa/mysqlclient-1.3.0.tar.gz#sha256=06eb5664e3738b283ea2262ee60ed83192e898f019cc7ff251f4d05a564ab3b7 (from https://pypi.org/simple/mysqlclient/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient
ERROR: No matching distribution found for mysqlclient

根據mysqlclient 的自述文件,在 macOS 上,您需要安裝mysqlmysql-client

 # Assume you are activating Python 3 venv $ brew install mysql $ pip install mysqlclient

如果不想安裝 MySQL 服務器,可以使用 mysql-client 代替:

 # Assume you are activating Python 3 venv $ brew install mysql-client $ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile $ export PATH="/usr/local/opt/mysql-client/bin:$PATH" $ pip install mysqlclient

您是否考慮過安裝pymysql ,一個純 Python MySQL 驅動程序?

此外,由於它是純粹的 pythonic,它比基於 c 的 MySQL 連接器更具交叉兼容性。

從終端

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools

暫無
暫無

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

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