提交 28975540 编写于 作者: D Dian Fu

[hotfix][python][docs] Improve the documentation about Python dependency management

上级 7668e4e3
......@@ -71,7 +71,7 @@ echo numpy==1.16.5 > requirements.txt
pip download -d cached_dir -r requirements.txt --no-binary :all:
# python code
stream_execution_environment.set_python_requirements("requirements.txt", "cached_dir")
stream_execution_environment.set_python_requirements("/path/to/requirements.txt", "cached_dir")
{% endhighlight %}
<p>Please make sure the installation packages matches the platform of the cluster and the python version used. These packages will be installed using pip, so also make sure the version of Pip (version >= 7.1.0) and the version of Setuptools (version >= 37.0.0).</p>
</td>
......@@ -86,9 +86,9 @@ stream_execution_environment.set_python_requirements("requirements.txt", "cached
zip -r py_env.zip py_env
# python code
stream_execution_environment.add_python_archive("py_env.zip")
stream_execution_environment.add_python_archive("/path/to/py_env.zip")
# or
stream_execution_environment.add_python_archive("py_env.zip", "myenv")
stream_execution_environment.add_python_archive("/path/to/py_env.zip", "myenv")
# the files contained in the archive file can be accessed in UDF
def my_func():
......@@ -103,9 +103,10 @@ def my_func():
<td>
<p>Sets the path of the python interpreter which is used to execute the python udf workers, e.g., "/usr/local/bin/python3".</p>
{% highlight python %}
stream_execution_environment.add_python_archive("py_env.zip")
stream_execution_environment.add_python_archive("/path/to/py_env.zip")
stream_execution_environment.get_config().set_python_executable("py_env.zip/py_env/bin/python")
{% endhighlight %}
<p>Please note that if the path of the python interpreter comes from the uploaded python archive, the path specified in set_python_executable should be a relative path.</p>
<p>Please make sure that the specified environment matches the platform that the cluster is running on.</p>
</td>
</tr>
......
......@@ -72,7 +72,7 @@ echo numpy==1.16.5 > requirements.txt
pip download -d cached_dir -r requirements.txt --no-binary :all:
# Python 代码
stream_execution_environment.set_python_requirements("requirements.txt", "cached_dir")
stream_execution_environment.set_python_requirements("/path/to/requirements.txt", "cached_dir")
{% endhighlight %}
<p>请确保这些依赖安装包和集群运行环境所使用的 Python 版本相匹配。此外,这些依赖将通过 Pip 安装, 请确保 Pip 的版本(version >= 7.1.0) 和 Setuptools 的版本(version >= 37.0.0)符合要求。</p>
</td>
......@@ -87,9 +87,9 @@ stream_execution_environment.set_python_requirements("requirements.txt", "cached
zip -r py_env.zip py_env
# python 代码
stream_execution_environment.add_python_archive("py_env.zip")
stream_execution_environment.add_python_archive("/path/to/py_env.zip")
# 或者
stream_execution_environment.add_python_archive("py_env.zip", "myenv")
stream_execution_environment.add_python_archive("/path/to/py_env.zip", "myenv")
# 归档文件中的文件可以被 Python 函数读取
def my_func():
......@@ -104,9 +104,10 @@ def my_func():
<td>
<p>配置用于执行 Python Worker 的 Python 解释器路径,如 "/usr/local/bin/python3"。</p>
{% highlight python %}
stream_execution_environment.add_python_archive("py_env.zip")
stream_execution_environment.add_python_archive("/path/to/py_env.zip")
stream_execution_environment.get_config().set_python_executable("py_env.zip/py_env/bin/python")
{% endhighlight %}
<p>如果 Python 解释器的路径指向上传的 Python 归档文件,那么通过 set_python_executable 设置的 Python 解释器的路径必须是相对路径。</p>
<p>请确保配置的 Python 环境和集群运行环境匹配。</p>
</td>
</tr>
......
......@@ -71,7 +71,7 @@ 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")
table_env.set_python_requirements("/path/to/requirements.txt", "cached_dir")
{% endhighlight %}
<p>Please make sure the installation packages matches the platform of the cluster and the python version used. These packages will be installed using pip, so also make sure the version of Pip (version >= 7.1.0) and the version of SetupTools (version >= 37.0.0).</p>
</td>
......@@ -86,9 +86,9 @@ table_env.set_python_requirements("requirements.txt", "cached_dir")
zip -r py_env.zip py_env
# python code
table_env.add_python_archive("py_env.zip")
table_env.add_python_archive("/path/to/py_env.zip")
# or
table_env.add_python_archive("py_env.zip", "myenv")
table_env.add_python_archive("/path/to/py_env.zip", "myenv")
# the files contained in the archive file can be accessed in UDF
def my_udf():
......@@ -103,9 +103,10 @@ def my_udf():
<td>
<p>Sets the path of the python interpreter which is used to execute the python udf workers, e.g., "/usr/local/bin/python3".</p>
{% highlight python %}
table_env.add_python_archive("py_env.zip")
table_env.add_python_archive("/path/to/py_env.zip")
table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")
{% endhighlight %}
<p>Please note that if the path of the python interpreter comes from the uploaded python archive, the path specified in set_python_executable should be a relative path.</p>
<p>Please make sure that the specified environment matches the platform that the cluster is running on.</p>
</td>
</tr>
......
......@@ -75,7 +75,7 @@ echo numpy==1.16.5 > requirements.txt
pip download -d cached_dir -r requirements.txt --no-binary :all:
# python 代码
table_env.set_python_requirements("requirements.txt", "cached_dir")
table_env.set_python_requirements("/path/to/requirements.txt", "cached_dir")
{% endhighlight %}
<p>请确保这些依赖安装包和集群运行环境所使用的 Python 版本相匹配。此外,这些依赖将通过 Pip 安装, 请确保 Pip 的版本(version >= 7.1.0) 和 Setuptools 的版本(version >= 37.0.0)符合要求。</p>
</td>
......@@ -90,9 +90,9 @@ table_env.set_python_requirements("requirements.txt", "cached_dir")
zip -r py_env.zip py_env
# python 代码
table_env.add_python_archive("py_env.zip")
table_env.add_python_archive("/path/to/py_env.zip")
# 或者
table_env.add_python_archive("py_env.zip", "myenv")
table_env.add_python_archive("/path/to/py_env.zip", "myenv")
# 归档文件中的文件可以被 Python 函数读取
def my_udf():
......@@ -107,9 +107,10 @@ def my_udf():
<td>
<p>配置用于执行 Python Worker 的 Python 解释器路径,如 "/usr/local/bin/python3"。</p>
{% highlight python %}
table_env.add_python_archive("py_env.zip")
table_env.add_python_archive("/path/to/py_env.zip")
table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")
{% endhighlight %}
<p>如果 Python 解释器的路径指向上传的 Python 归档文件,那么通过 set_python_executable 设置的 Python 解释器的路径必须是相对路径。</p>
<p>请确保配置的 Python 环境和集群运行环境匹配。</p>
</td>
</tr>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册