python下载地址:Python Source Releases | Python.org
查看数据库服务
dmPython 安装
cd /home/dmdba/dmdbms/drivers/python/dmPython
python setup.py install
[root@localhost dmPython]# python setup.py install
running install
running bdist_egg
running egg_info
writing dmPython.egg-info/PKG-INFO
writing top-level names to dmPython.egg-info/top_level.txt
writing dependency_links to dmPython.egg-info/dependency_links.txt
reading manifest file 'dmPython.egg-info/SOURCES.txt'
writing manifest file 'dmPython.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/dmPython.so -> build/bdist.linux-x86_64/egg
creating stub loader for dmPython.so
byte-compiling build/bdist.linux-x86_64/egg/dmPython.py to dmPython.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying dmPython.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying dmPython.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying dmPython.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying dmPython.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/dmPython-2.3-py2.7-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 dmPython-2.3-py2.7-linux-x86_64.egg
Removing /usr/lib64/python2.7/site-packages/dmPython-2.3-py2.7-linux-x86_64.egg
Copying dmPython-2.3-py2.7-linux-x86_64.egg to /usr/lib64/python2.7/site-packages
dmPython 2.3 is already the active version in easy-install.pthInstalled /usr/lib64/python2.7/site-packages/dmPython-2.3-py2.7-linux-x86_64.egg
Processing dependencies for dmPython==2.3
Finished processing dependencies for dmPython==2.3
测试连接:
>>> import dmPython
/usr/lib64/python2.7/site-packages/dmPython-2.3-py2.7-linux-x86_64.egg/dmPython.py:3: UserWarning: Module dmPython was already imported from /usr/lib64/python2.7/site-packages/dmPython-2.3-py2.7-linux-x86_64.egg/dmPython.pyc, but /home/dmdba/dmdbms/drivers/python/dmPython is being added to sys.path
>>> conn=dmPython.connect(user='SYSDBA',password='SYSDBA',server='localhost',port='5236')
>>> cursor=conn.cursor()
>>> cursor.execute('select status$ from v$instance')
<__builtin__.DmdbCursor on <dmPython.Connection to SYSDBA@localhost:5236>>
>>> value=cursor.fetchall()
>>> value
[('OPEN',)]
>>> exit()
可能会遇到的问题记录:
1.安装过程中会遇到python版本与dmPython不匹配的问题,如果执行“python setup.py install”不成功,可以试下降低python的版本或者替换新的dmPython包
2.gcc未安装
3.数据库环境变量未配置