Three Min Series - Setting up the dev environment for Pyflink 1.9

Motivation/动机

The goal of this blog is to help users quickly build a PyFlink dev environment.

本篇目标是帮助用户快速搭建PyFlink的开发环境。

Steps/操作步骤

  • Check dependencies

1
2
3
mvn --version
scala -version
python --version

You can set a soft link by:

"sudo ln -s /usr/local/Cellar/python/3.7.3/bin/python3 /usr/local/bin/python"

for your python3.

1
2

which pip

You can install the "pip" by:

"curl -O https://bootstrap.pypa.io/get-pip.py; sudo python get-pip.py"

for current python.

  • Download Source code

1
git clone https://github.com/apache/flink.git

  • Build PyFlink1.9

1
2
3
git fetch origin release-1.9; 
git checkout -b release-1.9 origin/release-1.9;
mvn clean install -DskipTests -Dfast

  • Install PyFlink 1.9

1
cd flink-python; python setup.py sdist; pip install dist/*.tar.gz --user

  • Check installation status

1
2

pip list |grep apache-flink

  • Download PyCharm

1
curl -O https://download.jetbrains.8686c.com/python/pycharm-community-2019.2.dmg

  • Install IDE and create new Project

NOTE: Ensure the python Interpreter should be points to which is python.

  • Copy WordCount example and run it

1
cp ~/foryou/flink/build-target/examples/python/table/batch/word_count.py {to your project dir}.

Video presentation/视频演示

Q&A

If you have questions, you can leave a comment or send an email: sunjincheng121@gmail.com

如有疑问,您可以发表评论或发送电子邮件:sunjincheng121@gmail.com