首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pyflink get_gateway()方法不工作

Pyflink get_gateway()方法不工作
EN

Stack Overflow用户
提问于 2021-05-21 19:00:17
回答 1查看 77关注 0票数 0

我使用PyCharm运行简单的pyflink最新1.13示例(它只有两行)。但是get_gateway()方法不起作用。

对于解释器,我创建了虚拟环境并在我的PyCharm项目中使用它。我还下载了Java8。我尝试了许多步骤来解决这个问题,但是

代码语言:javascript
复制
from pyflink.common.serialization import Encoder
from pyflink.common.typeinfo import Types
from pyflink.datastream import StreamExecutionEnvironment
from pyflink.datastream.connectors import StreamingFileSink
def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_parallelism(1)
代码语言:javascript
复制
C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\Scripts\python.exe C:/Users/myuser/PycharmProjects/pythonProject3/main.py
Hi, PyCharm
Traceback (most recent call last):
  File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 19, in <module>
    print_hi('PyCharm')
  File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 13, in print_hi
    env = StreamExecutionEnvironment.get_execution_environment()
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\datastream\stream_execution_environment.py", line 688, in get_execution_environment
    gateway = get_gateway()
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\java_gateway.py", line 62, in get_gateway
    _gateway = launch_gateway()
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\java_gateway.py", line 106, in launch_gateway
    p = launch_gateway_server_process(env, args)
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\myvenv\lib\site-packages\pyflink\pyflink_gateway_server.py", line 221, in launch_gateway_server_process
    return Popen(command, stdin=PIPE, preexec_fn=preexec_fn, env=env)
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
EN

回答 1

Stack Overflow用户

发布于 2022-04-12 09:49:53

有关描述,请参见类似的问题:https://stackoverflow.com/a/71840491/272023

JAVA_HOME没有指向有效的Java安装。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67642584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档