回到顶部

阅读目录

MacOS mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

安装环境

Mac OS

django 2.2

错误日志

pip install mysqlclient
(qingjiu) yinzhuoqundeMacBook-Pro:QingJiuSystem yinzhuoqun$ pip install mysqlclient

Collecting mysqlclient
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/yinzhuoqun/.pyenv/qingjiu/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/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/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/pip-egg-info
         cwd: /private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/private/var/folders/s8/71zy7vn50wlbm52k9650cf9h0000gn/T/pip-install-j69_cnqu/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解决方法

brew install mysql
(qingjiu) yinzhuoqundeMacBook-Pro:QingJiuSystem yinzhuoqun$ brew install mysql
Updating Homebrew...
==> Installing dependencies for mysql: protobuf
==> Installing mysql dependency: protobuf
==> Downloading https://homebrew.bintray.com/bottles/protobuf-3.11.4.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/80/809461047f541cfc72d836ea7c7af95ad18f090
######################################################################## 100.0%
==> Pouring protobuf-3.11.4.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/protobuf/3.11.4: 268 files, 19.6MB
==> Installing mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-8.0.19.mojave.bottle.2.tar.gz
==> Downloading from https://akamai.bintray.com/23/233aa7bfef136a19a02d443b9b2d8525f84ffa0
######################################################################## 100.0%
==> Pouring mysql-8.0.19.mojave.bottle.2.tar.gz
==> /usr/local/Cellar/mysql/8.0.19/bin/mysqld --initialize-insecure --user=yinzhuoqun --ba
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mysql/8.0.19: 286 files, 288.7MB
==> Caveats
==> mysql
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start

重新安装

(qingjiu) yinzhuoqundeMacBook-Pro:QingJiuSystem yinzhuoqun$ mysql_config 
Usage: /usr/local/bin/mysql_config [OPTIONS]
Compiler: AppleClang 11.0.0.11000033
Options:
        --cflags         [-I/usr/local/Cellar/mysql/8.0.19/include/mysql ]
        --cxxflags       [-I/usr/local/Cellar/mysql/8.0.19/include/mysql ]
        --include        [-I/usr/local/Cellar/mysql/8.0.19/include/mysql]
        --libs           [-L/usr/local/Cellar/mysql/8.0.19/lib -lmysqlclient -lssl -lcrypto]
        --libs_r         [-L/usr/local/Cellar/mysql/8.0.19/lib -lmysqlclient -lssl -lcrypto]
        --plugindir      [/usr/local/Cellar/mysql/8.0.19/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [8.0.19]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/local/Cellar/mysql/8.0.19/include/mysql]
                pkglibdir     [/usr/local/Cellar/mysql/8.0.19/lib]
                plugindir     [/usr/local/Cellar/mysql/8.0.19/lib/plugin]
(qingjiu) yinzhuoqundeMacBook-Pro:QingJiuSystem yinzhuoqun$ pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... done
  Created wheel for mysqlclient: filename=mysqlclient-1.4.6-cp36-cp36m-macosx_10_9_x86_64.whl size=55844 sha256=56e05f54d0e742490e4487de47d7a26a9c6c48b37e0b397aa73fe69d7f14a9c7
  Stored in directory: /Users/yinzhuoqun/Library/Caches/pip/wheels/c6/8c/80/527c233e7cb169f828b7168ebeab0fc5206d09b0fa133472fb
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

 

^_^
请喝咖啡 ×

文章部分资料可能来源于网络,如有侵权请告知删除。谢谢!

前一篇: centos7 mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
下一篇: Django admin ForeignKey 字段增加搜索选择框