2016-07-15 81 views
0

我想在tf.contrib模塊中使用初始值設定項和batch_norm,但是我的程序說找不到它。我重新安裝tensorflow仍然不能使用tf.contrib模塊。誰能告訴我爲什麼?如何更新tensorflow以支持tf.contrib?

+0

哪個tensorflow版本'打印(TF .__版本__)'你有嗎? –

+0

我嘗試這個命令,並得到:'模塊'對象沒有屬性'__version__' – Joey

+0

我發現它。版本2.0。我安裝錯了嗎? – Joey

回答

0

我不知道你做了什麼,但你肯定沒有谷歌最新的Tensorflow版本。您應該按照this tutorial進行安裝。

概括起來:

  1. 請確保您有依賴關係:sudo apt-get install python-pip python-dev
  2. 卸載不管你現在所擁有的:pip uninstall tensorflow
  3. 設置變量:

選擇正確一個:

# 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 

# 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 
  • 安裝它
  • 選擇正確的一個:

    # Python 2 
    $ sudo pip install --upgrade $TF_BINARY_URL 
    
    # Python 3 
    $ sudo pip3 install --upgrade $TF_BINARY_URL 
    
    +0

    我再次使用anaconda安裝併成功。謝謝! – Joey