安装过程中一直报错:

EnvironmentError: mysql_config not found

最终下面的方式解决:

58down voteaccepted

+200

Ok, well, first of all, let me check if I am on the same page as you:

  • You installed python
  • You did brew install mysql
  • You did export PATH=$PATH:/usr/local/mysql/bin
  • And finally, you did pip install MySQL-Python

If you did all those steps in the same order, and you still got an error, read on to the end, if, however, you did not follow these exact steps try, following them from the very beginning.

So, you followed the steps, and you're still geting an error, well, there are a few things you could try:

  1. Try running which mysql-config from bash. It probably won't be found. That's why the build isn't finding it either. Try running locate mysql-config and see if anything comes back. The path to this binary needs to be either in your shell's $PATH environment variable, or it needs to be explicitly in the setup.py file for the module assuming it's looking in some specific place for that file.

  2. Instead of using MySQL-Python, try using 'mysql-connector-python', it can be installed using pip install mysql-connector-python. More information on this can be found here andhere.

  3. Manually find the location of 'mysql/bin', 'mysql_config', and 'MySQL-Python', and add all these to the $PATH environment variable.

  4. If all above steps fail, then you could try installing 'mysql' using MacPorts, in which case the file 'mysql_config' would actually be called 'mysql_config5', and in this case, you would have to do this after installing: export PATH=$PATH:/opt/local/lib/mysql5/bin. You can find more details here.

Note1: I've seen some people saying that installing python-dev and libmysqlclient-dev also helped, however I do not know if these packages are available on Mac OS.

Note2: Also, make sure to try running the commands as root.

I got my answers from (besides my brain) these places (maybe you could have a look at them, to see if it would help): 1234.

I hoped I helped, and would be happy to know if any of this worked, or not. Good luck.

mac 上面安装mysql-python的更多相关文章

  1. Mac下安装Mysql出现 Can’t connect to local MySQL server through socket '/tmp/mysql.sock'

    在Mac下安装mysql出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock' 错误,解决如下: $ unset ...

  2. 配置apache,及mac下安装mysql

    先打开apache,在浏览器上输入  localhost     回车后会如果屏幕上显示:It works! 如下图: 这说明你的apache已开启 在window下配置apache: 1.找到apa ...

  3. mac 初次配置apache,及mac下安装mysql

    先打开apache,在浏览器上输入  localhost     回车后会如果屏幕上显示:It works! 如下图: 这说明你的apache已开启 mac 下apache配置(mac自带apache ...

  4. Mac下安装MySQL 5.6.40

    Mac下安装MySQL 5.6.40 - 干勾鱼的CSDN博客 - CSDN博客   原创 Mac下安装MySQL 5.6.40 2018-06-18 10:34:03 我是干勾鱼 阅读数 5927 ...

  5. Mac 平台安装MySQL

    Mac 平台安装MySQL   一.下载MySQL MySQL官网上https://dev.mysql.com/downloads/mysql/,下载Community Server版 出现如下界面, ...

  6. 在Mac下安装MySQL

    在Mac下安装MySQL   最近开始将开发工具都转移到 Mac 上了,其中也会莫名其妙的遇到一些坑,不如干脆将整个流程都记录下来,方便以后查找. 下载与安装 首先进入 MySQL 官网,选择免费的C ...

  7. Mac 下安装 MySQL 步骤

    安装 MySQL Mac 下安装MySQL推荐去官网下载dmg 版本的,我使用的版本是5.7.30. 如上图所示. 之后就是傻瓜式一键狂点不过需要注意的是,不要关闭下图所示的框框!不要关闭下图所示的框 ...

  8. 在Mac上安装mysql并配置环境(详细篇)

    在Mac上安装mysql并配置环境(详细篇) 1.下载mysql mysql官网 这一步根据自己电脑架构选择,分为arm和x86 下载完成之后打开就可以 接下来运行安装就可以,一直下一步,设置完密码就 ...

  9. mac下安装MySQL完整步骤(图文详情)

    原文摘自:http://www.jb51.net/article/103841.htm 最近使用Mac系统,准备搭建一套本地web服务器环境.因为Mac系统自带PHP和apach,但是没有自带mysq ...

  10. Mac下安装MySQL、Workbench以及建数据库建表最基础操作

    刚用上Mac,什么都不懂,加之以前还没有用过mysql,就想着在Mac上装一个mysql来自己玩,奈何,在网上找了大半天,没有一个干货!愤怒!下面是我安装的过程,希望能帮到和我情况差不多的朋友   首 ...

随机推荐

  1. centos 编译安装nginx

    这里选用的是nginx-1.10.1稳定版,其基础依赖库有gcc.gcc-c++.pcre.zlib和openssl. pcre.zlib和openssl这三个依赖库在安装nginx时无需编译安装,下 ...

  2. mysql 查看数据库中所有表的记录数

    use information_schema; SELECT DISTINCT t.table_name, t.engine '表引擎', t.table_rowsFROM TABLES tWHERE ...

  3. 【 VS 插件开发 】三、Vs插件简单功能的实现

    [ VS 插件开发 ]三.Vs插件简单功能的实现

  4. 算法系列——huffman编码

    哈夫曼编码,旨在对信息实现一种高效的编码,这种编码中任何一个都不是其他编码的前缀码.因此,在实际接收时,一旦匹配,就可以立即解码. 具体算法过程可以参加网上的很多教程. 给出一个自己的实现,一方面加强 ...

  5. 前端知识点-CSS相关知识点

    1.解释一下CSS的盒子模型? 回答一: a.标准的css盒子模型:宽度=内容的宽度+边框的宽度+加上内边具的宽度 b.网页设计中常听的属性名:内容(content).填充(padding).边框(b ...

  6. 《Intel汇编第5版》 汇编逆转字符串

    一.逆转字符串 逆转一个字符串可以利用栈这个数据结果,顺次读取所有元素压栈,再出栈所有元素即可逆序 二.push和pop指令 三.pushfd和popfd 四.pushad和popad 五.代码以及结 ...

  7. CSS display:inline-block的元素特点:

    将对象呈递为内联对象,但是对象的内容作为块对象呈递.旁边的内联对象会被呈递在同一行内,允许空格. 在CSS中,块级对象元素会单独占一行显示,多个block元素会各自新起一行,并且可以设置width,h ...

  8. ring3 hook ZwWriteVirtualMemory

    typedef LONG NTSTATUS;typedef NTSTATUS (NTAPI *PNtZwWriteVirtualMemory) ( IN HANDLE hProcess, IN PVO ...

  9. C#的初步学习,心得

  10. Java Swing 如何添加输入文字并且可以滚动的文本框?( JTextArea ,JScrollPane的使用)

    准备: JTextArea 文本区,一个可以输入文字的文本框 常用方法: 1.setText(String t)设置文本区中显示的文本 2.getText() 获取文本区中显示的文本 JScrollP ...