python

  • 1. 以python package 安装scipy

Try to install it as a python package using pip as follows

$ sudo apt-get install python-scipy

If you want to run a python 3.x script, install scipy by:

$ pip3 install scipy
Otherwise install it by: $ pip install scipy

注意添加到PYTHONPATH里面

  • 2. 如何run python programes on yarn clusters/ spark standalone clusters

方案一:在所有的slave和master上部署好所需要的python环境,如:Numpy

方案二:将所需要的python dependency 打包进virtual environment, 然后用spark-submit提交任务即可,需要指定--archives venv.zip

ubantu上安装可以采用:

  apt-get update
  apt-get install -y python-setuptools python-dev
  apt-get insall -y gcc make
  apt-get install -y zip
  easy_install pip
  • 3. 使用nootbooks(如:Jupyter notebook)

首先安装依赖的环境:

sudo apt install python

sudo apt install python-pip

sudo pip install numpy scipy pandas scikit-learn matplotlib seaborn wordcloud

launch the Jupyter notebook,需要指定:

export PYTHONPATH=${PYTHON_API_PATH}:$PYTHONPATH
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS="notebook --notebook-dir=./ --ip=* --no-browser"
${SPARK_HOME}/bin/pyspark \
  --master ${MASTER} \
  -- ...

jupyter dashboard URL is http://your_node:8888/

 

介绍:

Jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言。

官网地址:https://jupyter.readthedocs.io/en/latest/install.html

 

python 一些简单应用:

dict类型是key-value对

for item in vocab:
    print(item + ":" + str(vocab[item]))

转载于:https://www.cnblogs.com/lightsun/p/7110580.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值