【发布时间】:2012-01-04 10:28:39
【问题描述】:
我目前正在尝试为 Python 构建和安装 mySQLdb 模块,但是命令
python setup.py build
给我以下错误
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-intel-2.7/MySQLdb
error: could not delete 'build/lib.macosx-10.3-intel-2.7/MySQLdb/release.py': Permission denied
我确认我是 root 用户,当我尝试使用 sudo 执行脚本时,我得到一个 gcc-4.0 错误:
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-fat-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.3-fat-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
这很奇怪,因为我将 XCode 4 与 Python 2.7 一起使用。我已经尝试过 easy_install 和 pip 方法,这两种方法都不起作用,并且在 release.py 上给了我一个权限被拒绝的错误。我已经修改了那个文件,看看这是否是问题所在,但没有运气。想法?
【问题讨论】:
-
在我看来您没有安装 gcc,您使用的是什么操作系统?
标签: python mysql django mysql-python