Python的庫sklearn安裝 & bazel安裝 & cmake

Python的庫sklearn安裝

也可以用pip安裝(如:pip installscikit-learn),但安裝的位置不同,安裝是包名不同(apt-get安裝的python包一般前綴是python),python用的時候優先選擇apt-get安裝的包。如果用pip freeze 安裝的包的版本和在python環境(進入python導包,查看版本)看到的版本不同,可能就是用apt-getpip都安裝了,然後選擇性的保留就行了(建議保留pip的)

 

安裝scipy 0.16.1

1scipy需要依賴numpy包,先安裝numpy

2、用pip install scipy==0.16.1安裝scipy,安裝時報錯:building 'dfftpack' library error:library dfftpacy hasFortran sources but no Fortran compiler found。這是沒有安裝gfortran編譯器(沒有gfortran編譯器),安裝gfortran命令如下:sudo apt-getinstall gfortran

3、重新安裝scipy,安裝時又報了 numpy.distutils.system_info.NotFoundError:no lapack/blas resources found 

4、用ls

 /usr/lib | grep blas查看,缺少了一些libopenblas系統庫(缺少libopenblas),用sudo

 apt-get install libopenblas-dev安裝該庫,安裝後查看如下:


5、重新用用pip install scipy==0.16.1安裝scipy,結果依然報同一個錯誤,網上查結果缺少 lapack 

庫(缺少lapack),安裝 lapack 包:$

 sudo apt-get install liblapack-dev,如果還是不行則是缺少

atlas 再安裝 atlas包:sudo

 apt-get install libatlas-dev

6、安裝成功後重新安裝

 scipy pip install scipy==0.16.1成功完成安裝。

網上查詢後的總結:安裝numpy後安裝scipy失敗(報錯:numpy.distutils.system_info.NotFoundError)一般是缺少一些系統庫,需要安裝:libopenblas-devliblapack-devlibatlas-devlibblas-dev

 

Python Installation Instructions

Precompiledpackages are available for linux x86_64 platform and python 2.

  • Install stable version: pip install gbdt
  • Install latest development version: pip install git+https://github.com/yarny/gbdt.git

gbdt安裝python版本------

**pip源碼安裝;***yum installpython-devel.x86_64  yum installpython27-python-devel.x86_64  ---> pipinstall numpy >= 0.6 && pip install SciPy >= 0.9 ;(numpy.distutils.system_info.NotFoundError: no lapack/blas resources found)--->  yum install blas* && yuminstall lapack* --->  pip installSciPy ( python -c "import scipy; print scipy.__version__") & pipinstall sklearn

 

C++ Binary Compilation Instructions

Thepackage can be compiled in both Linux and OSX platforms. It depends on bazel, gflags,glogs, gperf, protobuf3. Per limitation of bazel, for linux, please use ubuntu 14 andabove to build. The built binary can be used in lower version linux machine. Weinclude a convenient script to set up the dependencies.

  1. Install bazel
  2. Run setup_dependencies/setup.sh.   ---》 需要cmake命令
  3. Run bazel build -c opt src:gbdt to build the binary.
  4. Find your binary at bazel-bin/src/gbdt.

5.       安裝c 版本,但是需要bazel支持,bazel又需要依賴JDK1.8

6.       /usr/local/bazel,

7.        

8.      ####安裝JDK略過

9.      ### 安裝bazel

10.  https://github.com/bazelbuild/bazel/releases下載源碼。。。

11.   

12.  

13.    ####[@10.134.105.160 GBDT]#./bazel-0.4.4-installer-darwin-x86_64.sh --user

14.      raw set itself is deprecated.

15.    - Remove support for --javawarn; use e.g.--javacopt=-Xlint:all

16.      instead

17.   

18.  ## Build informations

19.     - [Build log](http://ci.bazel.io/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=darwin-x86_64/1246/)

20.     -[Commit](https://github.com/bazelbuild/bazel/commit/80a07b5)

21.  Uncompressing.......

22.   

23.  Bazel is now installed!

24.   

25.  Make sure you have"/root/bin" in your path. You can also activate bash

26.  completion by adding thefollowing line to your ~/.bashrc:

27.    source /root/.bazel/bin/bazel-complete.bash

28.   

29.  Seehttp://bazel.build/docs/getting-started.html to start a new project!

30.  [@10.134.105.160 GBDT]#

Linux(centos7)源碼安裝cmake

1. 下載cmake源碼

[html] view plain copy

1. wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz  

2.解壓縮

[html] view plain copy

1. tar xzvf cmake-3.3.2.tar.gz  

3.進入到cmake文件夾中執行引導命令

注:此時會檢查gcc,gcc-c++,是否安裝和版本,如果沒有請先安裝

yum install gcc

yum install gcc-c++

[html] view plain copy

1. cd cmake-3.3.2  

2.   

3. ./bootstrap  

4.執行make

[html] view plain copy

1. gmake  

5.執行安裝(root權限)

[html] view plain copy

1. make install  

命令行下查看python和numpy的版本和安裝位置

1、查看python版本
方法一:
  python -V
  注意:‘-V‘中‘V’爲大寫字母,只有一個‘-’
方法二:
  python --version  
  注意:‘--version'中有兩個‘-’

2、查看python安裝位置
方法一: 
  python -c "import sys; print sys.executable"
方法二:
  python -c "import os; print os.sys.executable"
  python -c "import os; path = os.sys.executable;folder=path[0 : path.rfind(os.sep)]; print folder"

3、查看Numpy版本
python -c "import numpy; print numpy.version.version"
或
python -c "import numpy; print numpy.__version__"
4、查看Numpy安裝路徑
python -c "import numpy; print numpy.__file__"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章