首页 > 代码库 > 安装及使用tensorflow之syntaxnet

安装及使用tensorflow之syntaxnet

安装tensorflow之syntaxnet

在安装之前首先保证ubuntu、python、tensorflow,以及一些相应的包安装成功。

1.安装syntaxnet
#(1) pip

$ sudo apt-get install python-virtualenv

#(2) pip3

$ sudo apt-get install python3-virtualenv

2.在virtualenv中创建tensorflow环境

$ virtualenv --system-sit-packages ~/tensorflow

3.激活tensorflow的virtualenv环境

$ source ~/tensorflow/bin/activate

#(1) pip

(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

#(2) pip3

(tensorflow)$ pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl

4.测试tensorflow

$ python2.7
>>> import tensorflow

5.安装protobuf/asciitree/numpy

$ pip freeze | grep protobuf
$ pip install -U protobuf==3.0.0b2
$ pip install asciitree
$ pip install numpy

6.配置syntaxnet
***注意此部分必须在virtualenv中进行***

(tensorflow)$ git clone --recursive https://github.com/tensorflow/models.git
(tensorflow)$ cd models/syntaxnet/tensorflow
(tensorflow)$ ./configure
(tensorflow)$ cd ..
(tensorflow)$ bazel test syntaxnet/... util/utf8/...

**完全passed 12 tests**

7.测试syntaxnet

(tensorflow)$ echo Bob brought the pizza to Alice. | syntaxnet/demo.sh

 

安装及使用tensorflow之syntaxnet