gpt4 book ai didi

python - 在 OSX 10.6 上为 Python 安装 MySQLdb - 创建 .egg 时出错

转载 作者:行者123 更新时间:2023-11-30 23:37:03 24 4
gpt4 key购买 nike

在 Snow Leopard 上运行 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

有人知道我哪里错了吗?

最佳答案

可能有一次您尝试在 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

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

关于python - 在 OSX 10.6 上为 Python 安装 MySQLdb - 创建 .egg 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6560167/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com