Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说
ubuntu18.04安装caffe_ubuntu检查gpu命令,希望能够帮助你!!!。
http://http://blog.csdn.net/meccaendless/article/de由于之前已经配置好了ubuntu16.04+cuda9.1+cudnn7.04环境,参考我的这篇博文。这里不再赘述,caffe2官方安装说明讲的很详细,是按照ubuntu14.04和16.04分开说明的,这里只讲一下16.04下安装,基本上完全参考了官方安装步骤:
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libgoogle-glog-dev \
libprotobuf-dev \
protobuf-compiler \
python-dev \
python-pip
sudo pip install numpy protobuf
sudo apt-get install -y --no-install-recommends libgflags-dev
其它依赖项
sudo apt-get install -y --no-install-recommends \
libgtest-dev \
libiomp-dev \
libleveldb-dev \
liblmdb-dev \
libopencv-dev \
libopenmpi-dev \
libsnappy-dev \
openmpi-bin \
openmpi-doc \
python-pydot
sudo pip install \
flask \
graphviz \
hypothesis \
jupyter \
matplotlib \
pydot python-nvd3 \
pyyaml \
requests \
scikit-image \
scipy \
setuptools \
tornado
git clone --recursive https://github.com/caffe2/caffe2.git
cd caffe2
sudo make
cd build
sudo make install
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
这里显示success说明安装成功,若是Failure,在终端输入
python -c 'from caffe2.python import core'
看提示的ImportError:,缺什么库就sudo pip install下
如提示:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "caffe2/python/core.py", line 24, in <module>
from past.builtins import basestring
ImportError: No module named past.builtins
对应的解决方案是安装sudo pip install future 或者 pip install future --user
运行命令测试GPU-Caffe2是否编译成功:
python -m caffe2.python.operator_test.relu_op_test
若出现
Ran 1 test in 0.661s
OK
说明安装成功,若运行时间在数秒,可能是显卡性能问题,也可能cuda没有工作
sudo gedit ~/.bashrc
# 添加对应内容
source
echo $PYTHONPATH
# export PYTHONPATH=/usr/local:$PYTHONPATH
# export PYTHONPATH=$PYTHONPATH:/home/ubuntu/caffe2/build
echo $LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
在sudo pip install 安装支持包的时候终端可能会提示以下黄色的warning:
The directory ' xxxxxx' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
若出现以上提示,在sudo后加 -H,即sudo -H pip install。
每一步安装不能有报错,否则后面部署深度学习平台时会报错
今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
上一篇
已是最后文章
下一篇
已是最新文章