MySQL-Python安装 - 无法构建egg文件
MySQL-Python安装 - 无法构建egg文件
我正在尝试设置Python MySQL。我正在按照以下教程操作:
http://anthonyscherba.com/site/blog/django-mysql-install-mac
直到步骤5我都没问题。当我运行
$ python setup.py clean
我得到的结果是
/Users/msmith/Downloads/MySQL-python-1.2.4b4/distribute-0.6.28-py2.7.egg Traceback (most recent call last): File "setup.py", line 7, in use_setuptools() File "/Users/msmith/Downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 145, in use_setuptools return _do_download(version, download_base, to_dir, download_delay) File "/Users/msmith/Downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 125, in _do_download _build_egg(egg, tarball, to_dir) File "/Users/msmith/Downloads/MySQL-python-1.2.4b4/distribute_setup.py", line 116, in _build_egg raise IOError('Could not build the egg.') IOError: Could not build the egg.
admin 更改状态以发布 2023年5月24日
我按照以下的建议成功安装:
首先尝试使用pip安装:
pip install mysql-python
接着: (来自于这里: Django错误: vertualenv EnvironmentError: 找不到mysql_config)
echo "mysql_config = /usr/local/mysql/bin/mysql_config" >> ~/.virtualenvs/ENV_NAME/build/MySQL-python/site.cfg
然后, (来自于这里: cc1: 错误: 未识别的命令行选项“-Wno-null-conversion”在安装python-mysql时的mac 10.7.5上)
"尝试从/usr/local/mysql/bin/mysql_config中删除cflags -Wno-null-conversion -Wno-unused-private-field."
然后,再次安装:
pip install mysql-python
然后 (来自于这里: Python mysqldb: 库没有加载: libmysqlclient.18.dylib)
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
然后就可以工作了!