2017-03-29 1 views
0

私はPILをインストールしている無属性「関数imread」を持っていませんが、私は次のようなエラーメッセージが出続ける:私はimreadに関するすべての記事を経ていますが、運がなかったしている「モジュール」オブジェクトは、

'module' object has no attribute 'imread'. 

。何かご意見は?

Danys-MacBook-Pro:~ danymeneses$ python 
/Users/danymeneses/Desktop/autoencoder/main.py --dataset 
/Users/danymeneses/Desktop/autoencoder/dataseti --is_train True 

{'batch_size': 12, 
'beta1': 0.5, 
'checkpoint_dir': 'checkpoint', 
'dataset': '/Users/danymeneses/Desktop/autoencoder/dataseti', 
'epoch': 5, 
'image_size': 108, 
'is_crop': False, 
'is_run': False, 
'is_train': True, 
'learning_rate': 0.0002, 
'noise': 0.5, 
'output_dir': 'output', 
'sample_dir': 'samples', 
'train_size': inf} 
WARNING:tensorflow:Passing a `GraphDef` to the SummaryWriter is deprecated. 
Pass a `Graph` object instead, such as `sess.graph`. 
Traceback (most recent call last): 
File "/Users/danymeneses/Desktop/autoencoder/main.py", line 94, in <module> 
tf.app.run() 
File "/Library/Python/2.7/site-packages/tensorflow/python/platform/app.py", 
line 30, in run 
sys.exit(main(sys.argv)) 
File "/Users/danymeneses/Desktop/autoencoder/main.py", line 75, in main 
autoencoder.train(FLAGS) 
File "/Users/danymeneses/Desktop/autoencoder/model.py", line 186, in train 
sample = [get_image(sample_file, self.image_size, is_crop=self.is_crop) for 
sample_file in sample_files] 
File "/Users/danymeneses/Desktop/autoencoder/utils.py", line 23, in get_image 
return transform(imread(image_path), image_size, is_crop) 
File "/Users/danymeneses/Desktop/autoencoder/utils.py", line 38, in imread 
return scipy.misc.imread(path).astype(np.float) 
AttributeError: 'module' object has no attribute 'imread' 
+1

[scipy.miscモジュールの可能な複製には属性がありませんか?](http://stackoverflow.com/questions/15345790/scipy-misc-module-has-no-attribute-imple) – rayryeng

+0

PILの上部に枕を挿入してください。 – rayryeng

+0

どのように 'misc'をインポートしましたか?正しい方法は 'scipy import misc'です。 – hpaulj

答えて

1

返信いただきありがとうございます!私は私のpythonの複数のバージョンがインストールされていたことに気付かなかったので、私はちょうどこのように行ってきました:私は私の問題を解決し

python2.7 /Users/danymeneses/Desktop/autoencoder/main.py --dataset 
/Users/danymeneses/Desktop/autoencoder/datasetii --is_train True 

インストールピップ以来、私は解決私の問題を使用していたのpythonのバージョンを指定しますPillowはPythonのすべてのバージョンにPillowをインストールしていませんでした。

もう一度ありがとうございます!

0

上記の指定を適用する必要はありませんでしたが、同じコンピュータで実行されている別のバージョンがこの問題を引き起こす可能性があることを知って、問題を解決するのに役立ちました。はい、私はJupyterのノートブックに、カーネルメニューの値を変更してPython 3であることを伝えなければなりませんでした。

関連する問題