2012-10-27 160 views
0

我有Python 32位,我安装了MySQL社区服务器32位,我试图为Python安装MySQLdb。 我跑在Mac上安装MySQLdb

的easy_install的mysql-python的

,我有这个错误

> easy_install mysql-python 
Searching for mysql-python 
Reading http://pypi.python.org/simple/mysql-python/ 
Reading http://sourceforge.net/projects/mysql-python/ 
Reading http://sourceforge.net/projects/mysql-python 
Best match: MySQL-python 1.2.4b5 
Downloading http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4b5.zip#md5=4f645ed23ea0f8848be77f25ffe94ade 
Processing MySQL-python-1.2.4b5.zip 
Running MySQL-python-1.2.4b5/setup.py -q bdist_egg --dist-dir /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/egg-dist-tmp-GjLaFB 
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz 
Extracting in /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/temp/tmpOVVY_R 
Now working in /var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/temp/tmpOVVY_R/distribute-0.6.28 
Building a Distribute egg in /private/var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5 
/private/var/folders/ke/ke8HKCuzGB4LMCJ1eIAGqk+++TI/-Tmp-/easy_install-W_yT0e/MySQL-python-1.2.4b5/distribute-0.6.28-py2.6.egg 
unable to execute gcc-4.0: No such file or directory 
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1 

为什么GCC-4.0无法找到任何想法?我安装了Xcode和gcc 4.2.1。

回答

1

如果你在山狮,你的问题似乎已安装的Xcode命令行工具,如果你在Xcode先安装它们,这应该工作

+0

我对雪豹。它看起来像我不能安装mysqldb,因为我需要编译一个名为_mysql.c的文件。当我尝试使用gcc 4.2.2进行编译时,出现错误... – Youcha

0

如何不必做:pip install mysql-pythonpython 2.7>>>import MySQLdb

我遵循了所有这些步骤,我得到它的工作

对于酿造的情况下,它不会让你因权限更新。

chgrp -R admin /usr/local 
chmod -R g+w /usr/local 
chgrp -R admin /Library/Caches/Homebrew 
chmod -R g+w /Library/Caches/Homebrew 

brew update 
brew doctor ## <--i did not use that 
brew upgrade 

ALSO I IGNORED THE Xcode update error 

brew install mysql 

pip install mysql-python 

当我试图导入My​​SQLdb的把它扔到了我一些错误,所以我后面的链接波纹管所提供的建议。

sudo ln -s /Users/$USERNAME/anaconda/lib/libssl.1.0.0.dylib /usr/lib/libssl.1.0.0.dylib 
sudo ln -s /Users/$USERNAME/anaconda/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.1.0.0.dylib 

的链接我用

lib... issues

home bre update permission issue

install mysql with brew