2016-03-04 217 views
4

我想在Linux上安裝Tensorflow。不幸的是,我幾乎不能使用Ubuntu。在Linux上安裝tensorflow

我也跟着在網頁「https://www.tensorflow.org/versions/master/get_started/os_setup.html#create-the-pip-package-and-install

,我停留在「創建PIP包並安裝」的一部分。 當我鍵入「bazel build -c opt //tensorflow/tools/pip_package:build_pip_package」終端給我下面

No command 'bazel' found, did you mean: 
Command 'babel' from package 'openbabel' (universe) 
Command 'babel' from package 'babel-1.4.0' (universe) 
bazel: command not found 

這有什麼錯呢?

回答

7

您需要安裝「Bazel」,谷歌的本土構建工具來構建源代碼。你可以在這裏得到它:Installing Bazel

但是,如果你剛剛開始使用這個,你甚至需要打擾從源代碼構建?

也許你應該嘗試只安裝在此描述使用PIP有一個命令行的二進制代碼:pip installation

# Ubuntu/Linux 64-bit, CPU only: 
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled: 
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl 
1

我寫了一個小bash腳本,設置了Ubuntu的是準備運行TensorFlow。然而,也有一些依賴性的:-)

wget https://github.com/bazelbuild/bazel/releases/download/0.1.5/bazel-0.1.5-installer-linux-x86_64.sh -O bazel-0.1.5-installer-linux-x86_64.sh 
chmod +x bazel-0.1.5-installer-linux-x86_64.sh 
sudo ./bazel-0.1.5-installer-linux-x86_64.sh --user 
rm bazel-0.1.5-installer-linux-x86_64.sh 
sudo chown $USER:$USER ~/.cache/bazel/ 
0

您可以安裝

https://github.com/jasonmayes/Tensor-Flow-on-Google-Compute-Engine

從腳本在這裏你可以看到我是如何安裝巴澤勒,:可能是你有幫助張力從「pip安裝」直接或者你可以從源代碼安裝。如果您選擇從源代碼安裝。首先你應該安裝bazel,它是一個從源頭建立tensorflow的工具。

5

我遇到了類似的問題。然後我意識到,我忘了設置環境如下:

export PATH="$PATH:$HOME/bin" 
+2

@winhowes:它解決了這個問題對我來說,我想分享。我想知道原因behing得到這個答案的反對票。謝謝。 – Hasnat

+0

我沒有給它反對票。我只是添加了一些代碼,突出顯示 – winhowes

+0

@winhowes感謝您的答案。也許對於沒有工作的人來說。 – Hasnat

0

只是一個更新:本

# Ubuntu/Linux 64-bit, CPU only, Python 2.7 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 
# Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl 

# Mac OS X, CPU only, Python 2.7: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl 

# Ubuntu/Linux 64-bit, CPU only, Python 3.4 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp34-cp34m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 
# Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp34-cp34m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, CPU only, Python 3.5 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 
# Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl 

# Mac OS X, CPU only, Python 3.4 or 3.5: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py3-none-any.whl 
Install TensorFlow: 

# Python 2 
$ sudo pip install --upgrade $TF_BINARY_URL 

# Python 3 
$ sudo pip3 install --upgrade $TF_BINARY_URL 

更多細節:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md

0

如果您的系統點安裝,這是一件容易的事。如果沒有,請使用以下命令安裝pip:

sudo apt-get install python-pip python-dev 

您可以使用系統GPU或CPU運行Tensorflow。另請注意,截至目前,tensorflow僅支持Nvidia GPU。如果你有Nvidia GPU,reading this link會更好,因爲它提供了很好的清晰度。

對於CPU的安裝運行 -

  1. export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl

    此項設置的二進制文件所在的URL。它會不時發生變化,所以請確保您使用適當的網址。接下來,運行 -

  2. sudo pip install --upgrade $TF_BINARY_URL