Linux安装xgboost,Python以及oracle驱动失败

软件安装前需要检自己linux位数32或者64

 

1.软件安装Anaconda3-5.0.1-Linux-x86_64.sh  
     .sh文件安装方式调用命令bash Anaconda3-5.0.1-Linux-x86_64.sh(后续安装一路回车即可)

安装完成可以调用:

root@textLinux python-package]# conda list
# packages in environment at /root/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0            py36he11e457_0  
_py-xgboost-mutex         2.0                       cpu_0    conda-forge
alabaster                 0.7.10           py36h306e16b_0  
anaconda                  custom           py36hbbc8b67_0  
anaconda-client           1.6.5            py36h19c0dcd_0  
anaconda-navigator        1.6.9            py36h11ddaaa_0  
anaconda-project          0.8.0            py36h29abdf5_0  
asn1crypto                0.22.0           py36h265ca7c_1  
astroid                   1.5.3            py36hbdb9df2_0  
astropy                   2.0.2            py36ha51211e_4  
babel                     2.5.0            py36h7d14adf_0  
....


2.xgboost算法包安装,需要找到Linux适配版本 
        虚拟机联网可以直接调用:git clone --recursive https://github.com/dmlc/xgboost 这样需要进入文件编译安装
                                或者:conda install -c conda-forge xgboost离线 (直接安装) 
        安装下载安装包:xgboost-0.81-py2 .py3-none-manylinux1_x86_64.whl  
        whl文件是Python格式的文件Linux安装了Python直接pip install xgboost-0.81-py2.py3-none-manylinux1_x86_64.whl安装即可

[root@textLinux ~]# pip install xgboost-0.81-py2.py3-none-manylinux1_x86_64.whl 
Processing ./xgboost-0.81-py2.py3-none-manylinux1_x86_64.whl
Requirement already satisfied: scipy in ./anaconda3/lib/python3.6/site-packages (from xgboost==0.81)
Requirement already satisfied: numpy in ./anaconda3/lib/python3.6/site-packages (from xgboost==0.81)
Installing collected packages: xgboost
Successfully installed xgboost-0.81
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

备注:xgboost包下载错误或报错,需要选择Linux格式的安装包

[root@textLinux ~]# cd xgboost-master/
[root@textLinux xgboost-master]# ls
amalgamation  CITATION        CONTRIBUTORS.md  dmlc-core  Jenkinsfile             LICENSE   NEWS.md         rabit      src
appveyor.yml  cmake           cub              doc        Jenkinsfile-restricted  make      plugin          README.md  tests
build.sh      CMakeLists.txt  demo             include    jvm-packages            Makefile  python-package  R-package
[root@textLinux xgboost-master]# cd python-package/
[root@textLinux python-package]# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    for libfile in libpath['find_lib_path']():
  File "xgboost/libpath.py", line 49, in find_lib_path
    'List of candidates:\n' + ('\n'.join(dll_path)))
XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/root/xgboost-master/python-package/xgboost/libxgboost.so
/root/xgboost-master/python-package/xgboost/../../lib/libxgboost.so
/root/xgboost-master/python-package/xgboost/./lib/libxgboost.so
/root/anaconda3/xgboost/libxgboost.so

 


3.oracle驱动程序安装:cx_Oracle-7.0.0 .tar.gz解压tar -zxvf cx_Oracle-7.0.0.tar.gz
        后续安装:cd cx_Oracle-7.0.0进入该目录下调用Python setup.py install安装

[root@textLinux ~]# tar -zxvf cx_Oracle-7.0.0.tar.gz 
[root@textLinux ~]# cd cx_Oracle-7.0.0
[root@textLinux cx_Oracle-7.0.0]# ls
cx_Oracle.egg-info  LICENSE.txt  MANIFEST.in  odpi  PKG-INFO  README.txt  samples  setup.cfg  setup.py  src  test
[root@textLinux cx_Oracle-7.0.0]# python setup.py install
...

备注:在导入oracle 连接数据库报错:

[root@textLinux ~]# python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> conn=cx_Oracle.connect("scott/tiger@192.168.128.90:1521/orcl.example.com")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help

解决方案:
4.oracle客户端安装oracle-instantclient18.3-basic -18.3.0.0.0-1.x86_64.rpm 

[root@textLinux ~]# rpm -ivh oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-instantclient18.3-basic-18################################# [100%]


        安装失败,需要额外首先安装libaio rpm -ivh libaio-0.3.99-2.x86_64.rpm再次
        安装rpm -ivh oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
        (rpm默认安装在/ usr / lib目录下)
5.配置oracle客户端的环境变量:export LD_LIBRARY_PATH = / usr / lib / oracle / 18.3 / client64 / lib:$ LD_LIBRARY_PATH
        配置完成需要生效源/ etc / profile或者源〜/ .bash_profile (以实际配置的安装的环境为主)

      
        

export PATH=/root/anaconda2/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib:$LD_LIBRARY_PATH


        备注:如果调用oracle的失败可以尝试重启Linux的 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值