Caffe Python development environment Settings __python

Source: Internet
Author: User
Tags virtualenv
installing Python-dependent libraries

The following two libraries need to be installed because of the need to compile the Python Third-party library

$ sudo yum install python-devel numpy

Setting up the VIRTUALENV environment

$ virtualenv caffeenv
$ cd caffeenv
$ bin/activate

Install the Python third Party library

CD <path_to_caffe>/caffe-1.0/python
pip Install-r requirements.txt
compiling Pycaffe
$ make Pycaffe
Test

First you need to set the environment variable Pythonpath, as follows:

$ export Pythonpath=<path_to_caffe>/caffe-1.0/python: $PYTHONPATH

Run Python, go to interactive mode, and then use "Import Caffe" to test the environment.

Import Caffe
problem

In the construction of the environment also encountered a number of problems, is summarized as follows: The problem of a

The following error occurred while "Import Caffe"

Importerror:no module named _caffe

The problem is that Caffe is not added to the PYTHONPATH environment variable.

The workaround is to set the PYTHONPATH environment variable before running Python.

Export Pythonpath=/home/jhadmin/downloads/caffe-1.0/python: $PYTHONPATH
question two

The following error occurred while "Import Caffe"

Attributeerror: ' Bool_ ' of ' module ' object has no attribute

Solutions

$ make Pycaffe
question three

The following error occurred while "Import Caffe"

Cxx/ld-o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:10:31:fatal error:numpy/ Arrayobject.h:no such file or directory
 #include <numpy/arrayobject.h>

Solutions

sudo yum install NumPy 
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.