pyflink.datastream.stream_execution_environment.StreamExecutionEnvironment.set_python_executable#
- StreamExecutionEnvironment.set_python_executable(python_exec: str)[source]#
Sets the path of the python interpreter which is used to execute the python udf workers.
e.g. “/usr/local/bin/python3”.
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.Example:
# 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")
Note
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.
Note
The python udf worker depends on Apache Beam (version == 2.43.0). Please ensure that the specified environment meets the above requirements.
- Parameters
python_exec – The path of python interpreter.