install python-3.2 and MySQL for Python on SLES11SP1

罗允晨
2023-12-01

参照http://blog.chinaunix.net/uid-529096-id-2100576.html

install python-3.2 and MySQL for Python on centos5

1)os information
bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 # uname  -a
Linux bill131 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/Linux


2)install python-3.2
download python from
http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2

#./configure
#make
#make test (i skiped)
#make install

3)安装libmysqlclient-dev,此安装包在SLES11 SP1 SDK盘中
4) install MySQL-for-Python
download davispuh-MySQL-for-Python-3-9680e4b.tar.gz

https://github.com/davispuh/MySQL-for-Python-3/wiki

https://download.github.com/davispuh-MySQL-for-Python-3-9680e4b.tar.gz



bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 # tar -zxvf davispuh-MySQL-for-Python-3-a3c5b40.tar.gz
davispuh-MySQL-for-Python-3-9680e4b/
davispuh-MySQL-for-Python-3-9680e4b/.gitignore
davispuh-MySQL-for-Python-3-9680e4b/HISTORY
davispuh-MySQL-for-Python-3-9680e4b/MANIFEST.in
davispuh-MySQL-for-Python-3-9680e4b/MySQL_python.egg-info/
davispuh-MySQL-for-Python-3-9680e4b/MySQL_python.egg-info/SOURCES.txt
davispuh-MySQL-for-Python-3-9680e4b/MySQL_python.egg-info/dependency_links.txt
davispuh-MySQL-for-Python-3-9680e4b/MySQL_python.egg-info/top_level.txt
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/__init__.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/connections.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/CLIENT.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/CR.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/ER.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/FIELD_TYPE.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/FLAG.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/REFRESH.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/constants/__init__.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/converters.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/cursors.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/release.py
davispuh-MySQL-for-Python-3-9680e4b/MySQLdb/times.py
davispuh-MySQL-for-Python-3-9680e4b/README
davispuh-MySQL-for-Python-3-9680e4b/_mysql.c
davispuh-MySQL-for-Python-3-9680e4b/_mysql_exceptions.py
davispuh-MySQL-for-Python-3-9680e4b/doc/
davispuh-MySQL-for-Python-3-9680e4b/doc/FAQ.txt
davispuh-MySQL-for-Python-3-9680e4b/doc/MySQLdb.txt
davispuh-MySQL-for-Python-3-9680e4b/ez_setup.py
davispuh-MySQL-for-Python-3-9680e4b/metadata.cfg
davispuh-MySQL-for-Python-3-9680e4b/pymemcompat.h
davispuh-MySQL-for-Python-3-9680e4b/setup.cfg
davispuh-MySQL-for-Python-3-9680e4b/setup.py
davispuh-MySQL-for-Python-3-9680e4b/setup_common.py
davispuh-MySQL-for-Python-3-9680e4b/setup_posix.py
davispuh-MySQL-for-Python-3-9680e4b/setup_windows.py
davispuh-MySQL-for-Python-3-9680e4b/site.cfg
davispuh-MySQL-for-Python-3-9680e4b/tests/
davispuh-MySQL-for-Python-3-9680e4b/tests/capabilities.py
davispuh-MySQL-for-Python-3-9680e4b/tests/dbapi20.py
davispuh-MySQL-for-Python-3-9680e4b/tests/test_MySQLdb_capabilities.py
davispuh-MySQL-for-Python-3-9680e4b/tests/test_MySQLdb_dbapi20.py
davispuh-MySQL-for-Python-3-9680e4b/tests/test_MySQLdb_nonstandard.py

davispuh-MySQL-for-Python-3-9680e4b/win_build.cmd

bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 #  cd davispuh-MySQL-for-Python-3-a3c5b40

bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 # python3  setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.2
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.2
creating build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.2/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.2/MySQLdb
creating build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.2/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.2
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/local/include/python3.2m -c _mysql.c -o build/temp.linux-x86_64-3.2/_mysql.o -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -fno-strict-aliasing
In file included from _mysql.c:35:
/usr/include/mysql/my_config.h:484:1: warning: "HAVE_MBRTOWC" redefined
In file included from /usr/local/include/python3.2m/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/usr/local/include/python3.2m/pyconfig.h:457:1: warning: this is the location of the previous definition
_mysql.c:2724: warning: function declaration isn't a prototype
gcc -pthread -shared build/temp.linux-x86_64-3.2/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lssl -lcrypto -o build/lib.linux-x86_64-3.2/_mysql.cpython-32m.so


bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 # python3  setup.py install
running install
/usr/local/lib/python3.2/site-packages/distribute-0.6.26-py3.2.egg/setuptools/command/easy_install.py:290: UserWarning: Unbuilt egg for MySQL-python [unknown version] (/root/davispuh-MySQL-for-Python-3-a3c5b40)
  self.local_index = Environment(self.shadow_path+sys.path)
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.linux-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.2/MySQLdb
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.2/_mysql.cpython-32m.so -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.2/_mysql_exceptions.py -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-3.2/MySQLdb/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-3.2/MySQLdb/release.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-3.2/MySQLdb/cursors.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-3.2/MySQLdb/converters.py -> build/bdist.linux-x86_64/egg/MySQLdb
creating build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/REFRESH.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/FLAG.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/ER.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/CR.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/constants/CLIENT.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-3.2/MySQLdb/connections.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-3.2/MySQLdb/times.py -> build/bdist.linux-x86_64/egg/MySQLdb
byte-compiling build/bdist.linux-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/release.py to release.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/converters.py to converters.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/times.py to times.pyc
creating stub loader for _mysql.cpython-32m.so
byte-compiling build/bdist.linux-x86_64/egg/_mysql.py to _mysql.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/MySQL_python-1.2.3-py3.2-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing MySQL_python-1.2.3-py3.2-linux-x86_64.egg
creating /usr/local/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg
Extracting MySQL_python-1.2.3-py3.2-linux-x86_64.egg to /usr/local/lib/python3.2/site-packages
Adding MySQL-python 1.2.3 to easy-install.pth file


Installed /usr/local/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg
Processing dependencies for MySQL-python==1.2.3
Finished processing dependencies for MySQL-python==1.2.3

bill131:~/davispuh-MySQL-for-Python-3-a3c5b40 # ipython3
WARNING: IPython History requires SQLite, your history will not be saved
Python 3.2.2 (default, May  6 2012, 16:18:48) 
Type "copyright", "credits" or "license" for more information.


IPython 0.13 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.


In [1]: import MySQLdb


In [2]: My
MySQL_python.egg-info/  MySQLdb                 MySQLdb/                


In [2]: MySQLdb.
MySQLdb.BINARY                                   MySQLdb.NotSupportedError                        MySQLdb.escape_sequence
MySQLdb.Binary                                   MySQLdb.OperationalError                         MySQLdb.escape_string
MySQLdb.Connect                                  MySQLdb.ProgrammingError                         MySQLdb.get_client_info
MySQLdb.Connection                               MySQLdb.ROWID                                    MySQLdb.paramstyle
MySQLdb.DATE                                     MySQLdb.STRING                                   MySQLdb.release
MySQLdb.DATETIME                                 MySQLdb.TIME                                     MySQLdb.result
MySQLdb.DBAPISet                                 MySQLdb.TIMESTAMP                                MySQLdb.server_end
MySQLdb.DataError                                MySQLdb.Time                                     MySQLdb.server_init
MySQLdb.DatabaseError                            MySQLdb.TimeFromTicks                            MySQLdb.string_literal
MySQLdb.Date                                     MySQLdb.Timestamp                                MySQLdb.test_DBAPISet_set_equality
MySQLdb.DateFromTicks                            MySQLdb.TimestampFromTicks                       MySQLdb.test_DBAPISet_set_equality_membership
MySQLdb.Error                                    MySQLdb.Warning                                  MySQLdb.test_DBAPISet_set_inequality
MySQLdb.FIELD_TYPE                               MySQLdb.apilevel                                 MySQLdb.test_DBAPISet_set_inequality_membership
MySQLdb.IntegrityError                           MySQLdb.connect                                  MySQLdb.thread_safe
MySQLdb.InterfaceError                           MySQLdb.connection                               MySQLdb.threadsafety
MySQLdb.InternalError                            MySQLdb.constants                                MySQLdb.times
MySQLdb.MySQLError                               MySQLdb.debug                                    MySQLdb.version_info
MySQLdb.NULL                                     MySQLdb.escape                                   
MySQLdb.NUMBER                                   MySQLdb.escape_dict                              


In [2]: MySQLdb.version_info()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-f184997cc500> in <module>()
----> 1 MySQLdb.version_info()


TypeError: 'tuple' object is not callable


In [3]: MySQLdb.version_info
Out[3]: (1, 2, 3, 'final', 0)


In [4]: 
 类似资料:

相关阅读

相关文章

相关问答