centos 6.5 安装 cx_Oracle 5.12 步骤 ,使用oracle instantclient12.1

新建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一下

转载于:https://www.cnblogs.com/zihuxinyu/p/3549411.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 6.5上安装Oracle 11g的步骤如下: 1. 首先,进入图形化界面并使用oracle用户登录。进入安装目录。 2. 执行脚本 `./runfixup.sh`,以挂载本地镜像并接入相应的RPM包。 3. 进入RPM包所在的目录,依次安装以下包: - `glibc-common-2.12-1.132.el6.x86_64.rpm` - `kernel-headers-2.6.32-431.el6.x86_64.rpm` - `libgcc-4.4.7-4.el6.x86_64.rpm` - `glibc-2.12-1.132.el6.x86_64.rpm` 注意,在安装这些包时,使用 `--nodeps` 参数来忽略依赖关系。 4. 将下载的 `p13390677_112040_Linux-x86-64_1of7.zip` 和 `p13390677_112040_Linux-x86-64_2of7.zip` 文件放到即将安装Oracle的文件夹 `/opt/oracle` 中。\[2\] 请注意,安装Oracle数据库会占用大量内存,可能会影响计算机的运行速度。因此,建议将Oracle安装在虚拟机上,而不是本机。此外,如果第一次安装失败,再次安装时需要清理许多残留的注册表等文件,而这些注册表的位置可能不为人所知。因此,建议在虚拟机上安装Oracle数据库。\[3\] #### 引用[.reference_title] - *1* [centos6.5 安装oracle 11g 数据库](https://blog.csdn.net/qq_42817799/article/details/105198860)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [CentOS 6.5下安装Oracle 11g](https://blog.csdn.net/zjf307/article/details/40265101)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [centos6.5下安装oracle11g数据库步骤](https://blog.csdn.net/qq_25619743/article/details/78784671)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值