Ubuntu14.04+caffe+python Configuration Summary (CPU Edition) __python

Source: Internet
Author: User
1 Dependent packages required for installation 1.1 Install PROTOBUF, LEVELDB, snappy, OpenCV , HDF5, protobuf compiler and boost:
    sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev Protobuf-compiler
    sudo apt-get install--no-install-recommends Libboost-all-dev


1.2 Install dependencies, the commands below install, gflags, glogs and Atlas:

    sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
    sudo apt-get install Libatlas-base-dev


2 Configuring Python

To execute the command first:

sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn \
python-skimage Python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags \ Cython Ipython


After you finish executing the command, you can check to see if the installation was successful. After entering Python return, enter Python shell mode, import import NumPy (other packages, and so on) to check if the NumPy is properly installed and continue without an error.

If you execute the Python code, the File "numpy/coretup.py" appears, line-MB, in Check_types

"Cannot compile ' Python.h '. Perhaps you need to "

Systemerror:cannot compile ' Python.h '. Perhaps you need to install Python-dev|python-devel. "

The reason is that the Python.h file cannot be found, and the dependencies required to install NumPy (including Python.h (in Python-devel)) are: Apt-get BUILD-DEP python-numpy


3 Installation Caffe 3.1 Download Caffe

Caffe Download Address: https://github.com/BVLC/caffe/, after decompression, into its root directory, Caffe given a sample configuration file: Makefile.config.example, we need to copy the Makefile.config file through the command: CP Makefile.config.example Makefile.config

Because we only use the CPU, so we need to Makefile.config file "# cpu_only: = 1", the front of the # number can be removed.
3.2 Compiling Caffe

Enter the Caffe folder root directory, eg:~/usr/caffe$, and do the following:

Make all

Make Pycaffe

Make distribute time a little bit longer ...
3.3 Modifying the environment path

Add the following content to the ~/.BASHRC:

#caffe

Export pythonpath= $PYTHONPATH:/home/' username '/usr/caffe/python

Enter the source ~/.BASHRC for the configuration to take effect.
3.4 Test

ceshi.py:

The Import sys

sys.path.append ("/home/zk/usr/caffe/python") #python the interface path, which is not necessary if you are setting the environment variable.
Import Caffe

Compile ceshi.py Pass, the description is done, you can start the DL tour.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.