Reference website:
http://blog.csdn.net/sanmao5/article/details/51923982 ( main reference )
https://github.com/BVLC/caffe/issues/782 ( problem solving )
Ubuntu Configuration Caffe Python interface Pycaffe
- Depend on
caffe has been compiled correctly. See ubuntu configure caffe
- library package
- sudo apt-get install python-pip
- sudo atp-get install Python-dev python-numpy
- sudo apt-get install Gfortran
-
- sudo pip install–r python/requirements.txt
- sudo pip install Pydot
numpy scipy matplotlib sklearn skimage h5py protobuf leveldb networkx nose pandas gflags Cython Ipython GF Ortran
- Path
- VI ~/.BASHRC
Export Pythonpath=/usr/caffe/python: $PYTHONPATH
export Pythonpath=/usr/caffe/python/caffe: $PYTHONPATH// Please don't add this .
- SOURCE ~/.BASHRC
- Compile
- CD Caffe
- Make Pycaffe
- Problems and Solutions
Problem:
Traceback (most recent):
File "<stdin>", line 1, in <module>
File "/users//anaconda/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
From. Import Add_newdocs
File "/users//anaconda/lib/python2.7/site-packages/numpy/add_newdocs.py", line A, in <module>
From Numpy.lib import Add_newdoc
File "/users//anaconda/lib/python2.7/site-packages/numpy/lib/__init__.py", line A, in <module>
From. Npyio Import *
File "/users//anaconda/lib/python2.7/site-packages/numpy/lib/npyio.py", line 4, <module>
From. Import format
File "/users//anaconda/lib/python2.7/site-packages/numpy/lib/format.py", line 141, in <module>
Import IO
File "io.py", line 2, <module>
Import Skimage.io
File "/users//anaconda/lib/python2.7/site-packages/skimage/__init__.py", line 171, in <module>
From. Util.dtype Import *
File "/users//anaconda/lib/python2.7/site-packages/skimage/util/__init__.py", line 1, <module>
From. Dtype Import (Img_as_float, Img_as_int, Img_as_uint, Img_as_ubyte,
File "/users//anaconda/lib/python2.7/site-packages/skimage/util/dtype.py", line 8, <module>
Dtype_range = {Np.bool_: (False, True),
Attributeerror: ' Module ' object has no attribute ' Bool_
Solve:
https://github.com/BVLC/caffe/issues/782 ( problem solving )
Snshine
Firstly, you need _caffe.so In Caffe/python/caffe. If not, the run ' make Pycaffe ' in Caffe source folder.
Secondly, you need to add is Caffe/python to $PYTHONPATH and not caffe/python/caffe as mentioned in documentation. I don ' t know why adding Caffe/python/caffe causes the error, though.
Seanbell
@deartonym you should add $CAFFE _root/python to your $PYTHONPATH, not $CAFFE _root/python/caffe.
If you add "$CAFFE _root/python/caffe" and then you won ' t is able to do "import CAFFE".
Yangqing has posted:
Under the folder of Caffe-master/python/caffe, where _caffe.so lies, there is an io.py, which would being wrongly used by num Py.
Developfeng
If you succeeded "make Pycaffe" without error and cannot solve the "Attributeerror: ' Module ' object have no attribute ' Bool_ ' "problem after your set PYTHONPATH, you ' d better check if you set too much different Pathonpath via"Echo $PYTHONPATH", if has more than than one path, you can logout and login, thenadd" Expoet Pythonpa Th= $PYTHONPATH:/home/develop/caffe/python ", then has a try!
Ubuntu Configuration Caffe Python interface Pycaffe