新建sh文件
内容如下:
以su用户执行这个文件
#!/bin/bash

# INSTALL ORACLE INSTANT CLIENT #
################################# # NOTE: Oracle requires at least 1176 MB of swap (or something around there).
# If you are using CentOS in a VMWare VM, there's a good chance that you don't have enough by default.
# If this describes you and you need to add more swap, see the
# "Adding a Swap File to a CentOS System" section, here:
# http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space # Install basic dependencies
sudo yum -y install libaio bc flex echo "Now go get some the following two RPMs ..."
echo "- basic: oracle-instantclient12.1-basic-12.1.0.1.0-1.x86_64.rpm"
echo "- SDK/devel: oracle-instantclient12.1-devel-12.1.0.1.0-1.x86_64"
echo "... from this URL: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html"
echo "WARNING: It's pretty annoying, they make you sign up for an Oracle account, etc."
echo 'I will assume you have put these two files are into the same folder'
echo "Press any key once you're ready" && read -n 1 -s sudo rpm -ivh oracle-instantclient12.1-basic-*
sudo rpm -ivh oracle-instantclient12.1-devel-* # SET ENVIRONMENT VARIABLES #
############################# # Source for this section: http://cx-oracle.sourceforge.net/BUILD.txt # (SIDENOTE: I had to alter it by doing some digging around for where the Oracle RPMs really installed to;
# if you ever need to do this, do a command like this:
# rpm -qlp <rpm_file_of_concern.rpm>) echo '# Convoluted undocumented Oracle bullshit.' >> $HOME/.bashrc
echo 'export ORACLE_VERSION="12.1"' >> $HOME/.bashrc
echo 'export ORACLE_HOME="/usr/lib/oracle/$ORACLE_VERSION/client64/"' >> $HOME/.bashrc
echo 'export PATH=$PATH:"$ORACLE_HOME/bin"' >> $HOME/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$ORACLE_HOME/lib"' >> $HOME/.bashrc
. $HOME/.bashrc # INSTALL cx_Oracle #
##################### pip install cx_Oracle

  

 
 
 
 
 
 
如果执行出错,那么请下载cx_Oracle 5.12的源码进行编译
下载地址http://cx-oracle.sourceforge.net/
请对应python版本、OS版本
#python3 setup.py build install 
请修改setup.py中的
filesToCheck = [
                ("11g", "libclntsh.so.12.1"),
                ("10g", "libclntsh.so.10.1"),
                ("9i", "libclntsh.so.9.0")
因为我们安装的instantclient12.1是12.1版本,所以安装前检查文件的路径应该是libclntsh.so.12.1。
 
然后在python3中import cx_Oracle
不报错说明安装成功。
 

---更新

如果出现ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory
说明路径不对,没有加载上
执行# find / -name libclntsh.so.*获得实际的路径是
/usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1
那么要把这个路径加载上

编辑/etc/ld.so.conf

gedit /etc/ld.so.conf

在最后一行输入获取的路径

/usr/lib/oracle/12.1/client64/lib/

别忘了最后#ldconfig一下

centos 6.5 安装 cx_Oracle 5.12 步骤 ,使用oracle instantclient12.1的更多相关文章

  1. CentOS 7.0安装配置Vsftp服务器步骤详解

    安装Vsftp讲过最多的就是在centos6.x版本中了,这里小编看到有朋友写了一篇非常不错的CentOS 7.0安装配置Vsftp服务器教程,下面整理分享给各位. 一.配置防火墙,开启FTP服务器需 ...

  2. CentOS 7.2 安装 Docker 1.12.3 版

    本文出自http://www.cnblogs.com/scoter2008 1.强大的官方文档 https://docs.docker.com/engine/installation/linux/ce ...

  3. CentOS 6.5 安装Gitlab 7.12.2

    官网环境要求 参见:https://github.com/gitlabhq/gitlabhq GitLab is a Ruby on Rails application that runs on th ...

  4. Linux系统(Centos)下安装Java环境配置步骤详述

    1.首先要去下载好JDK,Java SE 8的官方网址是http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2 ...

  5. Docker 01 - CentOS 7 中安装 Docker 的详细步骤

    目录 1 初识 Docker 1.1 Docker 原理简介 1.2 Docker 核心概念 2 安装 Docker 2.1 查看系统内核版本 2.2 更新 yum 包 2.3 安装软件包 2.4 向 ...

  6. CentOS使用yum安装最新版nginx步骤

    sudo yum install yum-utilsvi  /etc/yum.repos.d/nginx.repo 输入: [nginx-stable]name=nginx stable repoba ...

  7. 安装教程-VMware 12 安装企业级 CentOS 7.6

    企业级 CentOS 7.6 系统的安装 1.实验描述 在虚拟机中,手动安装 CentOS 7.6 操作系统,为学习 Linux 提供平台,因此,有的参数有些差异,请勿较真. 2.实验环境 物理机系统 ...

  8. CentOs下安装PHP环境的步骤

    前言 在CentOs环境下安装php开发环境,需要首先安装一些源文件,然后使用yum命令直接安装即可,在Fedora 20 源中已经有了PHP的源,直接可以使用以下命令安装即可: # yum inst ...

  9. CentOS下一键安装Openstack

    CentOS下一键安装Openstack 系统环境:Oracle VirtualBox 4.38CentOS-6.5-x86_64-bin-DVD1.iso 安装前需要修改 /etc/hosts文件, ...

随机推荐

  1. 阅读 CMakeLists

    新手,入门阅读 CMakeLists,希望读者能给点建议 发现两篇文章,我感觉很好~ <阅读 CMakeLists>(下面只copy此篇)文章来源:http://blog.sina.com ...

  2. python抓取网页图片的小案例

    1.分析 ,要抓取的页面的信息以及对应的源码信息 blog.sina.com.cn/s/blog 93dc666c0101b1bj.html 2.代码模块: 导入正则表达的模块 导入url相关的模块 ...

  3. BZOJ2654/COGS1764 [2012国家集训队]tree(陈立杰) [生成树,二分]

    BZOJ传送门,COGS传送门 tree Description 给你一个无向带权连通图,每条边是黑色或白色.让你求一棵最小权的恰好有need条白色边的生成树. 题目保证有解. Input 第一行V, ...

  4. Redux 源码自己写了一遍

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content ...

  5. HDU5742 It's All In The Mind 数学思维题

    Problem Description Professor Zhang has a number sequence a1,a2,...,an. However, the sequence is not ...

  6. (疯狂java)第三课

    最近很忙,都没有看书,罪过... 第五章(面向对象上) 1.类是一种对数据结构的封装,也就是说,一个类在在理解上事存在实际的含义的,比如一个人类,人类也是个类,表明这个类不是家禽类,是有人的特点的生物 ...

  7. Problem C: 输入10个数,根据提示进行从小到大输出或从大到小输出

    #include<stdio.h> int main() { char ch; ]; while(scanf("%c",&ch)!=EOF) { int i,j ...

  8. php红包

    /**   转http://www.oschina.net/code/snippet_1392428_54532     谢谢 php_fangting * @param $total [你要发的红包 ...

  9. NHibernate 操作视图 第十三篇

    在NHibernate中,可以把视图当表一样操作,只需要记住一点就是,视图是只读的,因此映射实体的setter应该改为protected. 新建一个视图如下: 持久化类: public class C ...

  10. jQuery Ajax 参数解析

    简单的例子: $.ajax({ type:"post", data:{a:acon,b:bcon} , url:"ajax.php", async:false ...