美文网首页
2018-12-12

2018-12-12

作者: 秦弥思虚 | 来源:发表于2018-12-12 16:47 被阅读0次

First ,sorry, in my ubuntu ,i didn't install chinese input.so.....

When we want to use c++ to develop tensorflow apps, in ubuntu 14.04 ,u just do pip install ways, but in ubuntu 16.04 or ubuntu 18.04 ,you must compile it by yourself.

The precompiled version of Tensorflow can only be used with Ubuntu 14.04, for further explanations see here (requirements for the GPU version here). For Ubuntu 16.04 and 18.04 you must compile tensorflow from source.


1.ENVIROMENT SET UP

1.1 CUDA and CUDNN

first download cuda and cudnn that u use

I use cuda-9.0 and cudnn -7.0 ,I use tensorflow 1.8

$sudo sh cuda_9.0.176_384.81_linux.run
$sudo gedit  /etc/profile
$export  PATH=/usr/local/cuda-9.0/bin:$PATH
$export $LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64$$LD_LIBRARY_PATH  
$export CUDA_HOME=/usr/local/cuda

And then

$source .bashrc

test

$nvcc -V #output the cuda information

install cudnn

tar -zxvf cudnn-9.0-linux-x64-v7.tgz 
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/ 
sudo cp -a cuda/lib64/libcudnn* /usr/local/cuda/lib64/ 
sudo chmod a+r /usr/local/cuda/include/cudnn.h 
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

bazel

In the first, I use bazel 0.20, but faild,so i change version to 0.10.

$ sudo apt-get install autoconf automake libtool curl make g++ unzip# Protobuf

$ sudo apt-get install python-numpy swig python-dev python-wheel


$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

download bazel pick the version u like.

then u can compile and use.

tensorflow1.8 compile and use

$ cd tensorflow
$ ./configure

if u want to use the gpu version, choose to use cuda, other u'd better choose no.

$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

waitttttttttttttttttttttttttttttttttttttt.
..

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

u will find tensorflow in your /tmp/ folder

then

sudo pip install tensorflow-0.12.1-cp27-cp27mu-linux_x86_64.whl

problem and solve

1.pandas 0.23.3 has requirement python-dateutil>=2.5.0, but you'll have python-dateutil 1.5 which is incompatible.

sudo pip uninstall pandas
sudo pip install pandas

2.if u want to build tensor_ros_cpp

see faq

3.Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determi

pip install mock
sudo pip install --ignore-installed enum34

相关文章

网友评论

      本文标题:2018-12-12

      本文链接:https://www.haomeiwen.com/subject/fqjphqtx.html