依赖管理
- 依赖文件
table_env.add_python_file(file_path)
- 依赖存档(打包)文件
table_env.add_python_archive("py_env.zip", "myenv")
# the files contained in the archive file can be accessed in UDF
def my_udf():
with open("myenv/py_env/data/data.txt") as f:
- 依赖第三方项目
# commands executed in shell
echo numpy==1.16.5 > requirements.txt
pip download -d cached_dir -r requirements.txt --no-binary :all:
# python code
table_env.set_python_requirements("requirements.txt", "cached_dir")
- 指定Python Interpreter路径
table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")