当我使用以下代码在Flink CLI中运行Python文件时:
python3 word_count.py我得到的错误如下:
Traceback (most recent call last):
File "word_count.py", line 79, in <module>
word_count()
File "word_count.py", line 37, in word_count
t_config = TableConfig()
File "/usr/local/lib/python3.7/dist-packages/pyflink/table/table_config.py", line 49, in __init__
gateway = get_gateway()
File "/usr/local/lib/python3.7/dist-packages/pyflink/java_gateway.py", line 68, in get_gateway
callback_server_listening_address, callback_server_listening_port)
TypeError: 'JavaPackage' object is not callable我改变了运行这个Python文件的方式:
./bin/flink run --python3 /opt/flink/examples/python/table/batch/word_count.py我得到了另一个错误:
Could not build the program from JAR file.
Use the help option (-h or --help) to get help on the command.发布于 2021-01-05 10:29:10
没有解决第一个问题,但解决了第二个问题。
--python3中的命令导致了该错误。
官方的Pyflink命令是
./bin/flink run -py word_count.py由于我的docker中只有Python3,所以我使用以下命令将Python3软链接到Python.
ln -s /usr/bin/python3 /usr/bin/python 然后,正式的Pyflink命令就可以工作了。您可以通过Flink Web UI查看完成的作业。
发布于 2021-01-06 09:59:40
默认情况下,使用机器上的python解释器来编译pyflink作业,您可以通过python.client.executable更改它。
https://stackoverflow.com/questions/65560462
复制相似问题