请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

mac 安装不上mysqlclient

Using cached mysqlclient-1.3.0.tar.gz (76 kB)
ERROR: Command errored out with exit status 1:
command: ‘/Users/koumyou/Desktop/python代码笔记/venv/bin/python’ -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/3j/s01ymmvj5vscl88cpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/setup.py’"’"’; file=’"’"’/private/var/folders/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/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/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-pip-egg-info-64_5b3vb
cwd: /private/var/folders/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/
Complete output (10 lines):
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/setup.py”, line 17, in
metadata, options = get_config()
File “/private/var/folders/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/setup_posix.py”, line 47, in get_config
libs = mysql_config(“libs_r”)
File “/private/var/folders/3j/s01ymmvj5vscl88c526zpr8r0000gn/T/pip-install-o3d7jh7f/mysqlclient_7de5342b0ed7490798b42e350b3eb333/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

一直报这样的错误信息

正在回答 回答被采纳积分+3

1回答

deweizhang 2021-02-23 07:14:37

你在本机安装了mysql吗? 如果没有安装进行一下安全, 之后安装一些相关依赖  mysql-devel gcc gcc-devel python3-devel

0 回复 有任何疑惑可以回复我~
  • 提问者 天赐之子_光明兽 #1
    解决了,通过 mysqlclient https://pypi.org/project/mysqlclient/ 官网解决了
    
    macOS(自制)
    安装MySQL和mysqlclient:
    
    # 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
    
    因为我已经安装好了MySQL了,所以用的第二个方法配置好了mysqlclient
    回复 有任何疑惑可以回复我~ 2021-02-23 14:25:20
  • deweizhang 回复 提问者 天赐之子_光明兽 #2
    666
    回复 有任何疑惑可以回复我~ 2021-02-23 14:25:55
  • 提问者 天赐之子_光明兽 回复 deweizhang #3
    老师你的博客和公众号是多少,想关注多学习
    回复 有任何疑惑可以回复我~ 2021-02-23 14:41:32
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信