2016-11-15 55 views
0

我試圖運行tensorflow示例。TensorFlow r0.11給出TypeError:run()得到了一個意外的關鍵字參數'argv'

這裏是我的設置:

的Ubuntu 16.04

CUDA-回購ubuntu1604-8-0-local_8.0.44-1_amd64.deb

cudnn-8.0-Linux的x64的V5。 0-ga.tgz

https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp35-cp35m-linux_x86_64.whl

我試圖運行這樣的:

import tensorflow as tf 
hello = tf.constant('Hello, TensorFlow!') 
sess = tf.Session() 
print(sess.run(hello)) 
a = tf.constant(10) 
b = tf.constant(32) 
print(sess.run(a + b)) 

我看到這一點:

[email protected]:~/tf11 $ 
[email protected]:~/tf11 $ python tf10.py 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally 
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 
name: GeForce 940MX 
major: 5 minor: 0 memoryClockRate (GHz) 1.2415 
pciBusID 0000:01:00.0 
Total memory: 3.95GiB 
Free memory: 3.50GiB 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0) 
b'Hello, TensorFlow!' 
42 
[email protected]:~/tf11 $ 
[email protected]:~/tf11 $ 
[email protected]:~/tf11 $ 

我試圖運行這樣的:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

我看到這一點:

[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ python mnist_with_summaries.py 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally 
Traceback (most recent call last): 
    File "mnist_with_summaries.py", line 205, in <module> 
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) 
TypeError: run() got an unexpected keyword argument 'argv' 
[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
[email protected]:~/tensorflow/tensorflow/examples/tutorials/mnist $ 

我歡迎任何有關如何調試的想法。

+0

你能刪除',argv = [sys.argv [0]] + unparsed'部分嗎?無論如何,'main'並沒有使用它們。 – sygi

回答

0

argv最近被添加到app.run()函數中。因此,要使其工作,您必須刪除argv=...參數或從源代碼構建TensorFlow。

0

我有同樣的問題。 正在使用master分支,並獲得tensorflow存儲庫版本解決它。

git clone -b r0.11 https://github.com/tensorflow/tensorflow.git

如果使用暢達,一定要安裝/升級到新的版本波紋管: https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html

1) Create a conda environment called tensorflow:

"Python 2.7 " 

$ conda create -n tensorflow python=2.7 

"Python 3.4" 

$ conda create -n tensorflow python=3.4 

"Python 3.5" 

$ conda create -n tensorflow python=3.5 

2) Activate tensorfow:

source activate tensorflow 

3) Installation

conda install -c jjhelmus tensorflow=0.10.0rc0 

我我選擇一個特定版本作爲conda軟件包。

相關問題