【问题标题】:Installing MySQLdb for Python on OSX 10.6 - Error Creating .egg在 OSX 10.6 上安装 MySQLdb for Python - 创建 .egg 时出错
【发布时间】:2011-07-02 23:30:43
【问题描述】:

在雪豹上运行 Python 2.7 X86。安装 64 位 MySQL 以避免位版本之间的冲突。但是,安装 MySQLdb 时仍有问题。

在关注this 和其他各种在线指南之后,我还没有走近。我在安装过程中收到的输出是:

$ ARCHFLAGS='-arch x86_64' python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-x86_64-2.7/MySQLdb
running build_ext
copying build/lib.macosx-10.6-x86_64-2.7/MySQLdb/release.py -> build/bdist.macosx-10.6-x86_64/egg/MySQLdb
byte-compiling build/bdist.macosx-10.6-x86_64/egg/MySQLdb/release.py to release.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.macosx-10.6-x86_64/egg/_mysql.py to _mysql.pyc
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
writing build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/MySQL_python-1.2.3-py2.7-macosx-10.6-x86_64.egg' and adding 'build/bdist.macosx-    10.6-x86_64/egg' to it
error: dist/MySQL_python-1.2.3-py2.7-macosx-10.6-x86_64.egg: Permission denied

有人知道我哪里出错了吗?

【问题讨论】:

    标签: python mysql


    【解决方案1】:

    有一次您尝试在sudo 下运行python setup.py,现在有一个属于root 的dist 目录。清除构建目录中现有的dist 子目录并重新运行:

    sudo rm -rf ./dist
    ARCHFLAGS='-arch x86_64' python setup.py install
    

    如果您在最后的安装步骤中遇到权限错误,您可能需要运行sudo 下的install 步骤:

    sudo bash
    export ARCHFLAGS='-arch x86_64'
    /path/to/same/python2.7 setup.py install
    exit
    

    但如果没有必要,最好不要这样做。

    【讨论】:

    • 不客气。不要忘记将答案标记为已接受 - 这就是 StackOverflow 的工作方式!
    猜你喜欢
    • 1970-01-01
    • 2017-01-14
    • 2012-09-29
    • 1970-01-01
    • 2012-03-26
    • 2011-09-23
    • 2012-08-16
    • 1970-01-01
    • 2012-04-09
    相关资源
    最近更新 更多