AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow
Kev Dwyer
kevin.p.dwyer at gmail.com
Sun May 21 02:52:13 EDT 2017
Ho Yeung Lee wrote:
> i use window subsystem ubuntu
> and install python 3 and tensorflow
>
> then when try deep learning
>
> https://www.tensorflow.org/tutorials/wide_and_deep
>
> got error when urlretrieve local directory in ubuntu in window
>
> tried urllib3 still have error
>
> import tempfile
> import pandas as pd
> import urllib as urllib
> import os
>
> model_dir = tempfile.mkdtemp()
> m = tf.contrib.learn.DNNLinearCombinedClassifier(
> model_dir=model_dir,
> linear_feature_columns=wide_columns,
> dnn_feature_columns=deep_columns,
> dnn_hidden_units=[100, 50])
>
> ...
>
> urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/data.csv",
> train_file.name)
> urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/dataTest.csv",
> test_file.name)
>
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'urlretrieve'
If you're using python3, you need to do:
from urllib.request import urlretrieve
More information about the Python-list
mailing list