cx_Oracle安装
来源:互联网 发布:锐捷网络校园招聘笔试 编辑:程序博客网 时间:2024/05/16 13:52
已经先通过 anaconda 安装 了Python 2.7 (不想一个包一个包的安装 ,追求效率)
由于需要监控oracle数据库相关信息,打算通过python连接Oralce,采用cx_oracle方法
通过官方下载http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
instantclient-basic-linux.x64-11.2.0.4.0.zip
instantclient-sdk-linux.x64-11.2.0.4.0.zip
把两个压缩文件传至服务器 /tmp目录下
#unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
#unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip
# mv instantclient_11_2 /opt/
cp /opt/instantclient_11_2/* /usr/lib/ #偷懒,少配下环境变量
#vi /etc/profile
export ORACLE_HOME=/opt/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME:$ORACLE_HOME/sdk
保存退出
source /etc/profile
然pip install cx_Oracle
Collecting cx-Oracle Using cached cx_Oracle-5.2.tar.gzBuilding wheels for collected packages: cx-Oracle Running setup.py bdist_wheel for cx-Oracle Complete output from command /usr/local/anaconda2/bin/python -c "import setuptools;__file__='/tmp/pip-build-dLb_gK/cx-Oracle/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpB6s4P0pip-wheel-: running bdist_wheel running build running build_ext building 'cx_Oracle' extension creating build creating build/temp.linux-x86_64-2.7-11g gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/instantclient_11_2/sdk/include -I/usr/local/anaconda2/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.2 In file included from /opt/instantclient_11_2/sdk/include/oci.h:3045, from cx_Oracle.c:10: /opt/instantclient_11_2/sdk/include/ociap.h:10795: warning: function declaration isn’t a prototype /opt/instantclient_11_2/sdk/include/ociap.h:10801: warning: function declaration isn’t a prototype creating build/lib.linux-x86_64-2.7-11g gcc -pthread -shared -L/usr/local/anaconda2/lib -Wl,-rpath=/usr/local/anaconda2/lib,--no-as-needed build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -L/opt/instantclient_11_2 -L/usr/local/anaconda2/lib -lclntsh -lpython2.7 -o build/lib.linux-x86_64-2.7-11g/cx_Oracle.so /usr/bin/ld: cannot find -lclntsh collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1
cd /opt/instantclient_11_2
ln -s libclntsh.so.11.1 libclntsh.so
再次安装即可
#python
>>> import cx_Oracle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libaio.so.1: cannot open shared object file: No such file or directory
yum install -y libaio*
测试连接
# ipython
Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 19 2015, 18:04:42)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- 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 cx_Oracle
In [2]: conn = cx_Oracle.connect("scott/tiger@172.16.254.10/nwd")
---------------------------------------------------------------------------
DatabaseError Traceback (most recent call last)
<ipython-input-2-13b18d27d7de> in <module>()
----> 1 conn = cx_Oracle.connect("scott/tiger@172.16.254.10/nwd")
DatabaseError: ORA-28000: the account is locked
- cx_Oracle安装
- python调用cx_Oracle开发(-)---cx_Oracle安装
- python调用cx_Oracle开发(-)---cx_Oracle安装
- 安装python cx_oracle库
- mint安装cx_Oracle拓展
- cx_oracle pip 安装
- ubuntu 安装cx_Oracle
- RHEL 6.4 安装 cx_Oracle
- 在CentOS 安装 cx_Oracle
- linux安装cx_oracle
- Python安装cx_Oracle
- Win64安装cx_Oracle过程
- linux安装cx_Oracle模块
- cx_Oracle模块安装
- Mac 安装cx_Oracle
- python cx_Oracle安装
- windows virtualenv cx_oracle安装
- win7下安装CX_ORACLE
- python codeforces 322 div2 C
- 拍摄的照片上传之后旋转如何解决?
- 121 Best Time to Buy and Sell Stock
- spring框架学习(一)
- 移动端背景图片铺满屏幕
- cx_Oracle安装
- 麦子学院cocos2d听课截图
- 10段代码打通js学习的任督二脉
- 根据文件名修改文件(创业天使-xxx 120101_超清.mp4 --> 120101-创业天使-xxx.mp4)
- getReadableDatebase() 和getwriteableDatebase()
- spring框架学习(二)依赖注入
- 农商行信息化建设过程中存在哪些问题?
- Kibana User Guide [4.2] » Visualize » Vertical Bar Charts
- 动态调试pr_debug