简体   繁体   English

获取错误“ ValueError:int()的无效文字,基数为10:'3128;' 在运行Tensorflow训练示例时

[英]Getting an error "ValueError: invalid literal for int() with base 10: '3128;' while running the Tensorflow training example

So I did trace the error all the way back to the original file "client.py" and the error is clearly that there is a semicolon left trailing on the host variable. 因此,我确实将错误追溯到原始文件“ client.py”,错误显然是在主机变量上留下了分号。 I am actually just running sample code though FROM tensorflow samples and I don't expect that I'd be required to change any of these files. 我实际上只是通过tensorflow示例运行示例代码,并且我不希望我需要更改任何这些文件。 Any idea where the semicolon come from? 知道分号来自哪里吗? I'm using py = python3 to execute but I haven't changed anything 我正在使用py = python3执行,但我没有做任何更改

In the iris_data.py the variables passed are 在iris_data.py中,传递的变量是

TRAIN_URL = " http://download.tensorflow.org/data/iris_training.csv " TRAIN_URL =“ http://download.tensorflow.org/data/iris_training.csv

TEST_URL = " http://download.tensorflow.org/data/iris_test.csv " TEST_URL =“ http://download.tensorflow.org/data/iris_test.csv

C:\Python3\Lib\site-packages\tensorflow\models\samples\core\get_started>py premade_estimator.py
Downloading data from http://download.tensorflow.org/data/iris_training.csv
Traceback (most recent call last):
  File "C:\Python3\lib\http\client.py", line 798, in _get_hostport
    port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: '3128;'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "premade_estimator.py", line 88, in <module>
    tf.app.run(main)
  File "C:\Python3\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
    _sys.exit(main(argv))
  File "premade_estimator.py", line 34, in main
    (train_x, train_y), (test_x, test_y) = iris_data.load_data()
  File "C:\Python3\Lib\site-packages\tensorflow\models\samples\core\get_started\iris_data.py", line 19, in load_data
    train_path, test_path = maybe_download()
  File "C:\Python3\Lib\site-packages\tensorflow\models\samples\core\get_started\iris_data.py", line 12, in maybe_download
    train_path = tf.keras.utils.get_file(TRAIN_URL.split('/')[-1], TRAIN_URL)
  File "C:\Python3\lib\site-packages\tensorflow\python\keras\_impl\keras\utils\data_utils.py", line 238, in get_file
    urlretrieve(origin, fpath, dl_progress)
  File "C:\Python3\lib\urllib\request.py", line 188, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\Python3\lib\urllib\request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python3\lib\urllib\request.py", line 466, in open
    response = self._open(req, data)
  File "C:\Python3\lib\urllib\request.py", line 484, in _open
    '_open', req)
  File "C:\Python3\lib\urllib\request.py", line 444, in _call_chain
    result = func(*args)
  File "C:\Python3\lib\urllib\request.py", line 1282, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "C:\Python3\lib\urllib\request.py", line 1223, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)
  File "C:\Python3\lib\http\client.py", line 762, in __init__
    (self.host, self.port) = self._get_hostport(host, port)
  File "C:\Python3\lib\http\client.py", line 803, in _get_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: '3128;'

I managed to run the example but didn't reolve the URLproblem 我设法运行了示例,但没有解决URL问题

  1. Download the csv file to the get_started directory 将csv文件下载到get_started目录
  2. Open iris_data.py and set the path of TRAIN_URL and TEST_URL to the csv files 打开iris_data.py并将TRAIN_URL和TEST_URL的路径设置为csv文件

     TRAIN_URL = "iris_training.csv" TEST_URL = "iris_test.csv" 
  3. find the maybe_download function (line 11), comment out the implementation 找到maybe_download函数(第11行),注释掉实现
  4. Go to the function load_data() and comment out maybe_download() function call line 转到函数load_data()并注释掉maybe_download()函数调用行
  5. set train_path=TRAIN_URL and test_path = TEST_URL underneath that and before the pd.read_csv 在pd.read_csv下方和下方设置train_path = TRAIN_URL和test_path = TEST_URL

     train_path = TRAIN_URL test_path = TEST_URL train = pd.read_csv(train_path, names=CSV_COLUMN_NAMES, header=0) 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ValueError:tensorflow中以10为底的int()的无效文字 - ValueError: invalid literal for int() with base 10 in tensorflow 我不断收到此错误: ValueError: invalid literal for int() with base 10: '' - I keep getting this error: ValueError: invalid literal for int() with base 10: '' 错误 - ValueError:基数为10的int()的文字无效:&#39;&#39; - Error - ValueError: invalid literal for int() with base 10: ' ' 错误:ValueError:int()以10为底的无效文字: - Error: ValueError: invalid literal for int() with base 10: '' ValueError:int() 的无效文字,基数为 10:&#39;&#39; 错误 - ValueError: invalid literal for int() with base 10: '' error 在 pycharm 上加载经过训练的 Tensorflow 保存模型时出错。 ValueError:int() 的无效文字,基数为 10:&#39;class_name&#39; - Error while loading trained Tensorflow Saved Model on pycharm. ValueError: invalid literal for int() with base 10: 'class_name' ValueError: int() 的无效文字,以 10 为基数:运行 unittest 时为“30.0” - ValueError: invalid literal for int() with base 10: '30.0' when running unittest Tensorflow 从源错误 ValueError 构建:在 cuda 路径配置期间 int() 以 10 为基数的无效文字:''? - Tensorflow build from source error ValueError: invalid literal for int() with base 10: '' during cuda path configuration? 获取错误- year = int(year_field.get()) ValueError: invalid literal for int() with base 10: &#39;&#39; - Getting the error- year = int(year_field.get()) ValueError: invalid literal for int() with base 10: '' 为什么我得到ValueError:int()以10为底的无效文字:&#39;&#39; - Why am I getting ValueError: invalid literal for int() with base 10: ''
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM