1、jupyter notebook
修改配置文件
(a) 在个人账户下建立配置文件:jupyter notebook --generate-config
(b) Python环境下设置密码:
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:d66351142f0a:9eea3d7f99e434a6837f5e73af18d03cf0353392'(复制此行密码)
>>>exit()
© 打开jupyter notebook --generate-config文件:
/home/***(用户名)/.jupyter/jupyter_notebook_config.py
(d)
c.NotebookApp.ip='*' # * 代表所有iP都能访问 ,也可以指定ip
c.NotebookApp.password =u'sha1:d66351142f0a:9eea3d7f99e434a6837f5e73af18d03cf0353392' # 刚才复制的那个密文
c.NotebookApp.open_browser = False # 禁止自动打开浏览器
c.NotebookApp.port =9444 #指定一个端口
c.NotebookApp.port_retries = 50
c.NotebookApp.notebook_dir = '/home/user' #指定工作空间
c.PAMAuthenticator.encoding = 'utf8'
c.NotebookApp.allow_remote_access =True #出现错误就陪着这个
(e)为notebook配置spark环境
编辑 user/.bashrc
,增加:
export SPARK_HOME=/home/hadoop/spark-2.4.2-bin-hadoop2.6
export PATH=$SPARK_HOME/bin:$PATH
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'
source .bashrc
,然后在终端输入pysaprk
,就会启动notebook。
2、VScode
1、安装插件Remote-SSH
2、F1,输入ssh,找到Remote-SSH:settings
2.1 找到Remote.SSH: Show Login Terminal
,勾选Always reveal the SSH login terminal.
2.2 配置config,此处有个坑,windows会出现权限问题,不能用默认config。解决办法是使用另外的config文件并在,在Remote-SSH:settings,填写Remote.SSH: Config File
路径。