小编ech*_*o66的帖子

在 Apache Beam (python) 中使用 ToList 输出作为 AsSingleton 或 AsList 的输入

当我尝试使用beam.combiners.ToList 的输出作为beam.pvalue.AsSingleton 或beam.pvalue.AsList 的输入以试验侧输入时出现意外错误。我能够使用单个数字(例如:列表的平均值)作为辅助输入,但是对于列表和字典,我得到了例外。对于beam.pvalue.AsSingleton,我得到:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-0c1df7400a03> in <module>
     15 chain_total = chain_1 | chain_2
     16 
---> 17 chain_1 | beam.Map(m, beam.pvalue.AsList(chain_2))
     18 
     19 chain_total | beam.Map(print)

~/.cache/pypoetry/virtualenvs/prototyping-with-tensorflow-py3.6/lib/python3.6/site-packages/apache_beam/pvalue.py in __init__(self, pcoll)
    297     self.pvalue = pcoll
    298     self._window_mapping_fn = sideinputs.default_window_mapping_fn(
--> 299         pcoll.windowing.windowfn)
    300 
    301   def _view_options(self):

AttributeError: '_ChainedPTransform' object has no attribute 'windowing'
Run Code Online (Sandbox Code Playgroud)

对于beam.pvalue.AsList,我得到:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-0c1df7400a03> in <module>
     15 chain_total = chain_1 | chain_2
     16 
---> 17 chain_1 | …
Run Code Online (Sandbox Code Playgroud)

python-3.x apache-beam

5
推荐指数
1
解决办法
1323
查看次数

"TypeError:不支持的操作数类型 - =:在PIP升级期间'重试'和'int'"

我在Acer笔记本电脑上使用Ubuntu 16.04.2 LTS,我正在尝试更新我的pip安装(当前版本:8.1.1).当我运行命令

pip install --upgrade pip

我得到以下输出:

Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
    self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
    for …
Run Code Online (Sandbox Code Playgroud)

python pip

4
推荐指数
1
解决办法
9386
查看次数

标签 统计

apache-beam ×1

pip ×1

python ×1

python-3.x ×1