本文簡要介紹 python 語言中pyflink.datastream.StreamExecutionEnvironment.set_python_executable
的用法。
用法:
set_python_executable(python_exec: str)
設置用於執行 python udf worker 的 python 解釋器的路徑。
例如“/usr/local/bin/python3”。
如果 python UDF 依賴於集群中不存在的特定 python 版本,該方法
pyflink.datastream.StreamExecutionEnvironment.add_python_archive()
可用於上傳虛擬環境。通過該方法可以指定上傳環境中包含的python解釋器的路徑。例子:
# command executed in shell # assume that the relative path of python interpreter is py_env/bin/python $ zip -r py_env.zip py_env # python code >>> stream_env.add_python_archive("py_env.zip") >>> stream_env.set_python_executable("py_env.zip/py_env/bin/python")
注意:
請確保上傳的python環境與集群運行的平台相匹配,並且python版本必須為3.6或更高。
注意:
python udf worker 依賴於 Apache Beam(版本 == 2.27.0)。請確保指定的環境滿足上述要求。
參數:
python_exec - python 解釋器的路徑。
相關用法
- Python pyflink StreamExecutionEnvironment.set_python_requirements用法及代碼示例
- Python pyflink StreamExecutionEnvironment.set_restart_strategy用法及代碼示例
- Python pyflink StreamExecutionEnvironment.set_state_backend用法及代碼示例
- Python pyflink StreamExecutionEnvironment.set_stream_time_characteristic用法及代碼示例
- Python pyflink StreamExecutionEnvironment.set_default_savepoint_directory用法及代碼示例
- Python pyflink StreamExecutionEnvironment.enable_checkpointing用法及代碼示例
- Python pyflink StreamExecutionEnvironment.add_python_archive用法及代碼示例
- Python pyflink StreamExecutionEnvironment.register_type用法及代碼示例
- Python pyflink StreamExecutionEnvironment.add_default_kryo_serializer用法及代碼示例
- Python pyflink StreamExecutionEnvironment.register_type_with_kryo_serializer用法及代碼示例
- Python pyflink StreamTableEnvironment.from_data_stream用法及代碼示例
- Python pyflink StreamTableEnvironment.create用法及代碼示例
- Python pyflink StreamTableEnvironment.to_changelog_stream用法及代碼示例
- Python pyflink StatementSet.add_insert用法及代碼示例
- Python pyflink Session用法及代碼示例
- Python pyflink Slide用法及代碼示例
- Python pyflink Schema.Builder.watermark用法及代碼示例
- Python pyflink Schema.Builder.column_by_expression用法及代碼示例
- Python pyflink SlidingProcessingTimeWindows用法及代碼示例
- Python pyflink SlidingEventTimeWindows用法及代碼示例
- Python pyflink Table.intersect_all用法及代碼示例
- Python pyflink GroupedTable.select用法及代碼示例
- Python pyflink Expression.to_date用法及代碼示例
- Python pyflink Table.fetch用法及代碼示例
- Python pyflink PulsarSourceBuilder用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 pyflink.datastream.StreamExecutionEnvironment.set_python_executable。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。