如何修复`AttributeError:模块'apache_beam.coders.coders'没有属性'VarIntCoder'`

Jus*_*ler 2 python apache-beam

我正在构建 Apache Beam 管道,但在尝试导入管道选项时遇到了 AttributeError。

我正在使用 python3.6 在干净的虚拟环境中的 Ubuntu 服务器上进行测试

脚步:

virtualenv -p python3.6 beam-env
. beam-env/bin/activate
pip install apache_beam==2.12.0
python3.6 test.py
Run Code Online (Sandbox Code Playgroud)

内部test.py:

from apache_beam.options.pipeline_options import PipelineOptions
Run Code Online (Sandbox Code Playgroud)

我希望导入成功,但出现以下错误:

AttributeError: 模块 'apache_beam.coders.coders' 没有属性 'VarIntCoder'

Kal*_*yuZ 24

我在使用 apache-beam 编写自己的数据管道时发现了一个非常奇怪的行为:只要在名为test.py.

假设您有当前的实现main.py,您只需要将整个代码复制到test.py文件中,然后它就会在两个文件上产生错误。

我现在解决此问题的唯一方法是删除该 test.py 或将其重命名为其他名称,问题就消失了。

  • 这很奇怪,但重命名确实有帮助。 (3认同)
  • 这非常奇怪,几分钟前我想测试光束并将其命名为 test.py (2认同)