Mac下安装MySQLdb过程及问题
2014-03-08 16:42
459 查看
首先,到 http://sourceforge.net/projects/mysql-python/ 下载,
然后解压:tar zxvf MySQL-python-1.2.4b4.tar
进入解压的文件目录,运行命令:python setup.py install 进行安装。
如果中间没出问题,那你也太lucky了,这不科学!
下面是会出现的问题:
1.如果碰到 "mysql_config not found" 的问题,编辑文件夹下的site.cfg文件,去掉#mysql_config = /usr/local/bin/mysql_config前的注释,修改后面的路径为mysql_config真实目录就可以了(一般为/usr/local/mysql/bin/mysql_config),然后再执行python setup.py
install看是否有错。
2.如果碰到有显示setup_posix.py的问题,这还是目录问题,原因就是setup_posix.py 里的mysql_config.path 的默认路径是mysql_config,要将其目录改为mysql_config的真实目录 mysql_config.path = "/usr/local/mysql/bin/mysql_config" ,然后再执行python
setup.py install
3.如果出现以下问题:
………………Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-3121.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.………………
则将python setup.py install命令改为 sudo python setup.py install即可,然后输入密码安装。
4.安装完之后,终端进入python,执行import MySQLdb命令,如果没错,说明一切OK了,
如果遇到 “image not found”问题,则运行以下两行命令:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
这个问题就解决了。
然后解压:tar zxvf MySQL-python-1.2.4b4.tar
进入解压的文件目录,运行命令:python setup.py install 进行安装。
如果中间没出问题,那你也太lucky了,这不科学!
下面是会出现的问题:
1.如果碰到 "mysql_config not found" 的问题,编辑文件夹下的site.cfg文件,去掉#mysql_config = /usr/local/bin/mysql_config前的注释,修改后面的路径为mysql_config真实目录就可以了(一般为/usr/local/mysql/bin/mysql_config),然后再执行python setup.py
install看是否有错。
2.如果碰到有显示setup_posix.py的问题,这还是目录问题,原因就是setup_posix.py 里的mysql_config.path 的默认路径是mysql_config,要将其目录改为mysql_config的真实目录 mysql_config.path = "/usr/local/mysql/bin/mysql_config" ,然后再执行python
setup.py install
3.如果出现以下问题:
………………Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-3121.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.………………
则将python setup.py install命令改为 sudo python setup.py install即可,然后输入密码安装。
4.安装完之后,终端进入python,执行import MySQLdb命令,如果没错,说明一切OK了,
如果遇到 “image not found”问题,则运行以下两行命令:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
这个问题就解决了。
相关文章推荐
- vmware安装mac过程中出现的EFI VMware Virtual SCSI Hard Drive问题
- cdh5.8.3安装过程中问题解决方法Error loading MySQLdb和No portmap or rpcbind service
- mac安装Scrapy过程以及遇到的问题
- Mac 下安装mysqldb 问题:一条命令解决mysql_config not found
- mac下安装TOMCAT过程及问题
- mac下安装mysqldb时出现的问题
- mac中mysql安装过程遇到的问题总结
- MacOS Lion 安装MySQLdb for python 遇到的问题
- Mac上Oracle数据库的安装及过程中一些问题的解决
- Mac上Oracle数据库的安装及过程中一些问题的解决
- 解决 Mac App Store 下载应用程序、安装应用程序过程中遇到的问题。
- MAC 虚拟机安装过程问题解决
- android studio在mac上的安装过程及问题解决
- mac 安装mysqldb组件包及mac中安装mysql-python遇到的问题
- esxi6.0 安装 Mac OS X 10.10 Yosemite 过程中遇到的问题
- mac系统sublime text2安装HTMLPrettify插件 过程及问题解决方案
- Mac 安装CocoaPods过程以及遇到Ruby问题解决方案
- MAC 10.6及以上安装PHP不能显示phpinfo的问题及安装过程
- C++编译过程中"没有找到MFC80UD.DLL,因此这个程序未能启动.重新安装应用程序可能会修复此问题"? 的彻底解决
- NS2.33在Ubuntu12.10的完整安装过程及相关问题