- StreamExecutionEnvironment.set_python_executable(python_exec: str)[source]#
Sets the path of the python interpreter which is used to execute the python udf workers.
If python UDF depends on a specific python version which does not exist in the cluster, the method
pyflink.datastream.StreamExecutionEnvironment.add_python_archive()can be used to upload a virtual environment. The path of the python interpreter contained in the uploaded environment can be specified via this method.
# 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")
Please make sure the uploaded python environment matches the platform that the cluster is running on and that the python version must be 3.7 or higher.
The python udf worker depends on Apache Beam (version == 2.43.0). Please ensure that the specified environment meets the above requirements.
python_exec – The path of python interpreter.