自己建设网站怎么被百度收入,wordpress制作教程,素材搜集网站,阿里云网络服务器转载#xff1a;http://blog.csdn.net/janronehoo/article/details/25207825 叨叨 短评#xff1a;这篇文章感觉是比较全面解决Mac MySQLdb模块安装问题的文章了#xff0c;特别转载一下 安装过程主要是mysql_config not found错误#xff0c;这个错误通常卡住很多初学者http://blog.csdn.net/janronehoo/article/details/25207825 叨叨 短评这篇文章感觉是比较全面解决Mac MySQLdb模块安装问题的文章了特别转载一下 安装过程主要是mysql_config not found错误这个错误通常卡住很多初学者以及安装后出现的 image not found 错误 版本Python 2.7.3 MySQL-python包中因此无论下载还是在pip中search都应该是搜寻MySQL-python。 流程 下载MySQLdb MySQL-python-1.2.4b4.tar下载后解压然后在终端Terminal中执行以下命令 new-host-3:~ iFantastic$ cd /Users/iFantastic/Downloads/MySQL-python-1.2.4b4
new-host-3:MySQL-python-1.2.4b4 iFantastic$ python setup.py install 使用PIP安装MySQLdb new-host-3:~ iFantastic$ pip install MySQL-python 无论是在线安装还是下载安装此时你可能会遇到第一个错误提示 EnvironmentError: mysql_config not found 解决mysql_config not found错误 因此下载安装时的解决办法为在MySQL-python的安装包中找到site.cfg文件打开它找到以下内容 # The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.
# mysql_config /usr/local/bin/mysql_config 将最后一句句首井号去掉并修改为 mysql_config /usr/local/mysql/bin/mysql_config 然后执行 $ python setup.py install 一般说来此时安装可以完成但仍有问题下文会继续阐述。 使用pip安装时没有办法修改site.cfg文件因此可以通过修改OS X的系统环境变量来解决找不到mysql_config的错误。 修改OS X环境变量打开终端在终端中使用vim打开“~/.bash_profile”如果没有安装vim那就显示隐藏文件用文本编辑器打开具体操作这里就不复述了。在.bash_profile中添加以下内容 PATH/usr/local/mysql/bin:${PATH}
export PATH
export DYLD_LIBRARY_PATH/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BITno
export VERSIONER_PYTHON_PREFER_32_BITyes 其中 VERSIONER_PYTHON_PREFER_64_BIT和VERSIONER_PYTHON_PREFER_64_BIT根据自己安装的MySQL进行选择。 $ sudo ln -s /usr/local/mysql/bin/* /usr/bin 解决 Reason: image not found 错误 安装完MySQL-python包后让我们import MySQLdb此时出现一个错误错误最后一行写着 Reason: image not found。 解决方法是在终端执行 $ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
$ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql 错误 clang: error: clang: note: this will be a hard error (cannot be downgraded to a warning) in the future 经网上查证http://www.tuicool.com/articles/zI7Vzu貌似是mac os的Xcode从5.1起给编译器规定对于未知参数传入视为error我们需要使用ARCHFLAGS将该error降级为warning因此最后的安装命令应该如下 sudo ARCHFLAGS-Wno-errorunused-command-line-argument-hard-error-in-future python setup.py build 参考 http://www.cnblogs.com/macro-cheng/archive/2011/10/25/mysql-001.html转载于:https://www.cnblogs.com/wuzhi-seo/p/5500039.html