PYFLINK 基础 (四):运行相关(四)PYFLINK 依赖管理

依赖管理

  1. 依赖文件
table_env.add_python_file(file_path)
  1. 依赖存档(打包)文件
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: 
  1. 依赖第三方项目
# 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")
  1. 指定Python Interpreter路径
table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")

 

posted @ 2021-06-09 23:53  秋华  阅读(585)  评论(0)    收藏  举报