1.ImportError: cannot import name caffe2_pb2
测试caffe2的pytorch环境是否正常的时候使用
root@lxsj-ThinkStation:~/pytorch# python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from caffe2.python import workspace
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "caffe2/python/__init__.py", line 2, in <module>from caffe2.proto import caffe2_pb2
ImportError: cannot import name caffe2_pb2
解决方案:在pytorch路径下,或者root目录下找到.bashrc文件,打开。
1. 在末尾fi后面 写入
export PYTHONPATH=/root/pytorch/build:/usr/local:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
然后