mac 上面安装mysql-python

安装过程中一直报错:

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.

时间: 2024-10-31 09:19:34

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

window和mac配置apache,及mac下安装mysql

先打开apache,在浏览器上输入  localhost     回车后会如果屏幕上显示:It works! 如下图: 这说明你的apache已开启 在window下配置apache: 1.找到apache的安装目录下的http.conf文件,打开此配置文件 2.在该文件中搜索 LoadModule php5_module 将前面的#号去掉 然后把后面的路径改为   php安装路径/php5apache2_2.dll 3.搜索 Directory   将下面的两个路径  改为项目所在文件夹 4.

mac osx安装mysql

0.下载地址 http://soft.macx.cn/2068.htm 1.安装 mysql-5.6......pkg 2.安装mysqlstartup....pkg 3.安装偏好mysql.prefpane 安装后密码为 root '空' 修改mysql密码 /usr/local/mysql/bin/mysqladmin -u root password newPassWord mysql manage client我选择:Navicat Premium mac osx安装mysql

Mac brew 安装mysql 报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket

安装mysql 最新版 56 brew install mysql 启动报错 ben:~ soul$ which mysql /usr/local/bin/mysql ben:~ soul$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 解决办法 运行 ben:~ soul$ mysql.server start Starting MySQL .

Mac下安装MySQL 5.6.40

Mac下安装MySQL 5.6.40 - 干勾鱼的CSDN博客 - CSDN博客 原创 Mac下安装MySQL 5.6.40 2018-06-18 10:34:03 我是干勾鱼 阅读数 5927 分类专栏: MYSQL MYSQL常见问题解析 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/dongdong9223/article/details/80722654 转载请注明出处:http

MAC上安装mysql服务

1.下载mysql 访问MySQL的官网http://www.mysql.com/downloads/ 然后在页面中会看到"MySQL Community Server"下方有一个"download"点击. 进入MySQL的下载界面(http://www.mysql.com/downloads/mysql/),如果你是用的Mac OS来访问的话那么就会默认为你选好了Mac OS X 平台,而下面罗列的都是在Mac OS上能用的MySQL的版本,如果是用的其他平台,在

在Mac上安装mysql数据库

1. 下载MySQL for mac: https://dev.mysql.com/downloads/installer/ 2. 双击mysql-5.7.17-macos10.12-x86_64.dmg进行解压, 双击mysql-5.7.17-macos10.12-x86_64.pkg进行安装 3. Continue -> Continue, Agree -> Install -> 输入管理员密码 4. 记录下来弹窗中的密码 5. 进入系统偏好设置, 找到mysql, 启动服务 6.

mac下面安装mysql问题

忘记密码是一件很头疼的事情,mac安装mysql初始密码忘记怎么办?具体解决办法如下 http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html 亲测方法3,已成功重置密码. (感谢@非常,告诉我官网就有重置方法,网上搜了一堆堆...另外,step1和2来源于MAC上Mysql忘记Root密码或权限错误的快速解决方案 英文不好,官方的没太看明白# #) step1: 苹果->系统偏好设置->最下边点mysql 在弹出页面中

Mac下安装MySQL及启动等常用命令

总结了下mac下的mysql安装步骤: eclipse JavaEE 下载         JDK -9 macosx下载 一.安装及启动服务 1. MySQL Server 下载.(以mysql-8.0.3-rc-macos10.12-x86_64.tar.gz为例) 2. 解压并mv至/usr/local/mysql.(其中mysql为跟目录) 3. cd /usr/local 然后 sudo chown -R root:wheel mysql (更改 mysql 安装目录所属用户与用户组)

在Mac上安装mysql数据库记录

下载mysql for mac: https://downloads.mysql.com/archives/community/注意:我下载的是社团版本,mysql版本要和你的MAC版本保持一致.当然,如果以前安装过其他的MYSQL版本,务必先卸载了. 双击mysql-8.0.0-dmr-osx10.11-x86_64.dmg进行解压, 安装. Continue -> Continue, Agree -> Install.记录下来弹窗中的密码. 进入系统偏好设置, 找到mysql, 启动服务

Mac上安装MySQL后在终端连接不上数据库Command not found

再Mac上安装好MySQL要想在终端输入mysql命令,但是报Command not found,解决办法 打开终端输入如下命令:  /usr/local/mysql/bin/mysql -u root -p 其中root为用户名.这时会出现如下命令:Enter password:  123456 这样就可以访问你的数据库服务器了 但是mac是没有默认root账户的,如果没有root账户,去登录会报错,如下图:  所以我们要登录root还得先创建个root账户 输入命令创建账户 sudo pas