`
flyit
  • 浏览: 8753 次
  • 性别: Icon_minigender_1
  • 来自: ...
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Snow Leopard 安装 Python MySQLdb 记录

阅读更多

1. 下载 mysql-python from sf.net

2. 解压,进入解压后的目录。

Input:
cd MySQL-python-1.2.3c1
python setup.py build

Output:
...
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-universal-2.6
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/Applications/MAMP/Library/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
...

Input:
export C_INCLUDE_PATH=/usr/local/mysql/include/
export LIBRARY_PATH=/usr/local/mysql/lib/
python setup.py build

Output:
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc -arch x86_64 build/temp.macosx-10.6-universal-2.6/_mysql.o -L/Applications/MAMP/Library/lib/mysql -lmysqlclient_r -lz -lm -o build/lib.macosx-10.6-universal-2.6/_mysql.so
ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file was built for i386 which is not the architecture being linked (ppc)
ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file was built for i386 which is not the architecture being linked (x86_64)

Input:
sudo python setup.py install

Output:
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'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-universal/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
running build_ext
creating build/bdist.macosx-10.6-universal/egg
copying build/lib.macosx-10.6-universal-2.6/.DS_Store -> build/bdist.macosx-10.6-universal/egg
copying build/lib.macosx-10.6-universal-2.6/_mysql.so -> build/bdist.macosx-10.6-universal/egg
copying build/lib.macosx-10.6-universal-2.6/_mysql_exceptions.py -> build/bdist.macosx-10.6-universal/egg
creating build/bdist.macosx-10.6-universal/egg/MySQLdb
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/__init__.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/connections.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
creating build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/__init__.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/CLIENT.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/CR.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/ER.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/FLAG.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/constants/REFRESH.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb/constants
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/converters.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/cursors.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/release.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
copying build/lib.macosx-10.6-universal-2.6/MySQLdb/times.py -> build/bdist.macosx-10.6-universal/egg/MySQLdb
byte-compiling build/bdist.macosx-10.6-universal/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/converters.py to converters.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/release.py to release.pyc
byte-compiling build/bdist.macosx-10.6-universal/egg/MySQLdb/times.py to times.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.macosx-10.6-universal/egg/_mysql.py to _mysql.pyc
creating build/bdist.macosx-10.6-universal/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.macosx-10.6-universal/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-universal/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-universal/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.macosx-10.6-universal/egg/EGG-INFO
writing build/bdist.macosx-10.6-universal/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg' and adding 'build/bdist.macosx-10.6-universal/egg' to it
removing 'build/bdist.macosx-10.6-universal/egg' (and everything under it)
Processing MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg
Removing /Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg
Copying MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg to /Library/Python/2.6/site-packages
Adding MySQL-python 1.2.3c1 to easy-install.pth file

Installed /Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg
Processing dependencies for MySQL-python==1.2.3c1
Finished processing dependencies for MySQL-python==1.2.3c1

Input:
ipython

In [2]: import MySQLdb

In [3]: dir(MySQLdb)
Out[3]:
['BINARY',
'Binary',
'Connect',
'Connection',
'DATE',
'DATETIME',
'DBAPISet',
'DataError',
'DatabaseError',
'Date',
'DateFromTicks',
'Error',
'FIELD_TYPE',
'IntegrityError',
'InterfaceError',
'InternalError',
'MySQLError',
'NULL',
'NUMBER',
'NotSupportedError',
'OperationalError',
'ProgrammingError',
'ROWID',
'STRING',
'TIME',
'TIMESTAMP',
'Time',
'TimeFromTicks',
'Timestamp',
'TimestampFromTicks',
'Warning',
'__all__',
'__author__',
'__builtins__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__revision__',
'__version__',
'_mysql',
'apilevel',
'connect',
'connection',
'constants',
'debug',
'escape',
'escape_dict',
'escape_sequence',
'escape_string',
'get_client_info',
'paramstyle',
'release',
'result',
'server_end',
'server_init',
'string_literal',
'test_DBAPISet_set_equality',
'test_DBAPISet_set_equality_membership',
'test_DBAPISet_set_inequality',
'test_DBAPISet_set_inequality_membership',
'thread_safe',
'threadsafety',
'times',
'version_info']

In [4]:

安装成功!

0
0
分享到:
评论

相关推荐

    Mac OS X10.6.3 Snow Leopard系统 中文版完整安装盘 下载地址连接

    若这个压缩包包含的是Snow Leopard的安装文件或相关工具,用户可能需要按照指示进行解压和安装操作。然而,需要注意的是,由于苹果已经停止对Snow Leopard的官方支持,下载和安装这样的旧系统可能面临与现代硬件和...

    snow leopard10A432安装全过程

    snow leopard10A432安装全过程 mac mac os x 安装snow leopard10A432安装全过程 mac mac os x 安装

    MAC OS X Snow Leopard 10.6 引导镜像Rebel_EFI和darwin

    在MAC OS X Snow Leopard的安装过程中,引导镜像包含Rebel EFI和Darwin这两个组件,它们共同作用于非Apple硬件或虚拟机上,使安装过程得以进行。Rebel EFI引导镜像会启动Rebel EFI程序,然后加载Darwin,最终由...

    Sever版苹果Mac OS X 10.6 Snow Leopard雪豹操作系统的BT种子

    4. **Web Server**:Snow Leopard Server包含了Apache Web服务器,支持PHP、Perl和Python等动态脚本语言,可以搭建高效的企业级网站和应用。 5. **FileVault 2**:提供全磁盘加密功能,保护数据安全,即使丢失或...

    Mac OS X Snow Leopard 10A432雪豹 BT种子

    PC安装Mac OS X Snow Leopard 10A432雪豹 安装指南 这是一篇PC安装Mac OS X Snow Leopard 10A432雪豹的安装指南 警告:在PC上安装X86 Mac OS X有风险,由此造成的一切损失由您自己承担。 硬盘有价,数据无价!实际...

    OS X_10.6 Snow Leopard 内置壁纸

    【标题】"OS X_10.6 Snow Leopard 内置壁纸" 涉及的知识点主要集中在苹果公司的操作系统——OS X(现称macOS)的历史版本及其视觉设计元素上。OS X 10.6 Snow Leopard(雪豹)是苹果在2009年发布的一个重要操作系统...

    mac snow leopard安装ruby

    ### Mac Snow Leopard 安装 Ruby 及 Ruby on Rails 开发环境搭建详解 #### 背景介绍 在 Mac OS X Snow Leopard(版本 10.6)系统下安装 Ruby 和进行 Ruby on Rails 的开发,是许多开发者特别是初学者可能会遇到的...

    教你在VMWare下安装MAC OS X Snow Leopard 10.6

    在VMWare中安装MAC OS X Snow Leopard 10.6是一种常见的在个人计算机上体验苹果操作系统的解决方案。这种方法避免了物理硬盘分区和刻录光盘的步骤,而是直接使用虚拟化软件和DMG镜像文件进行安装。以下是一个详细的...

    超实用教程用vmware虚_机安装mac snow leopard苹果雪豹系统

    本教程主要关注的是如何在虚拟机软件VMware中安装Mac OS X Snow Leopard(苹果雪豹系统)。Snow Leopard是苹果公司推出的一款操作系统,版本号为10.6,它以其优化的性能和对64位计算的支持而闻名。 【描述解读】 ...

    Mac.OSX_.Snow_.Leopard.Server.v10.6.3

    下载此种子文件后,用户可以使用BitTorrent客户端来下载Mac OS X Snow Leopard Server的完整安装镜像。 总结来说,Mac OS X Snow Leopard Server v10.6.3是一个为企业和组织设计的高效、易用的服务器操作系统,它...

    在windows 7下用VMware Workstation 7.0 虚拟机安装雪豹snow leopard 10.6

    在IT领域,尤其是在虚拟化技术的应用中,使用Windows 7下的VMware Workstation 7.0来安装Mac OS X Snow Leopard 10.6是一项既挑战性又极具实用价值的技术实践。本文将深入探讨这一过程中的关键步骤和技术要点,帮助...

    VMWare下安装MAC OS X Snow Leopard 10.6

    VMWare下安装MAC OS X Snow Leopard 10.6 VMWare是一款功能强大的虚拟机软件,通过它,我们可以在Windows操作系统上安装MAC OS X Snow Leopard 10.6。今天,我们将详细介绍使用VMWare安装MAC OS X Snow Leopard ...

    snow+leopard

    描述中提到的“mac下启动安装工具Snow Leopard”意味着这是一个用于在Mac计算机上安装Snow Leopard操作系统的程序。这个工具通常是一个DVD镜像或一个可引导的USB驱动器,用户可以通过它来启动Mac并进行系统安装。 ...

    Snow Leopard tools.zip

    "Snow Leopard tools.zip" 是一个专门针对Mac操作系统Snow Leopard(雪豹)的工具集合,用于在个人计算机(PC)上安装黑苹果系统。这个压缩包包含了一系列必要的实用程序和驱动程序,以帮助用户在非Apple硬件上成功...

    OS + Unix FreeBSD / MacOSX Snow Leopard 10.6.3-8 / MacBook Pro / apple / MC373

    标题 "OS + Unix FreeBSD / MacOSX Snow Leopard 10.6.3-8 / MacBook Pro / apple / MC373" 提供了关于操作系统安装和配置的信息,涉及到的主要知识点包括: 1. **Unix FreeBSD**: Unix FreeBSD 是一个自由、开放...

    OS + Unix FreeBSD / MacOSX Snow Leopard 10.6.3 / 10.6.7 / 10.6.8 v1.1

    标题 "OS + Unix FreeBSD / MacOSX Snow Leopard 10.6.3 / 10.6.7 / 10.6.8 v1.1" 提及的是苹果公司的Mac OS X操作系统的一个特定版本,即Snow Leopard(雪豹),这是Mac OS X的第12个主要版本。该版本在2009年发布...

    Mac OS X Snow Leopard(10.6雪豹).rtf

    Mac OS X Snow Leopard 原版系统,直接用磁盘工具恢复到优盘或者移动硬盘就可以启动安装,百度云盘

    Mac OS X Snow Leopard Server essential document

    Mac OS X Snow Leopard Server handbook, it contains content of supporting network and local network environment.

Global site tag (gtag.js) - Google Analytics