安装Miniconda
yum -y groupinstall "Development tools"
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel # 这行命令没试过,但可以正常完成配置
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
重启后可以使用conda命令
更换源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
安装Jupyter Lab
conda install jupyterlab
配置Jupyter-Lab
在base环境下进入python
执行如下命令
>>> from notebook.auth import passwd
>>> passwd()
>Enter password: # 输入密码,用于进入jupyter lab
>Verify password: # 注:输入时不显示输入情况
'sha1:*********' # 保存这段hash码
>>> quit()
生成配置文件
jupyter notebook --generate-config
编辑配置文件
vi ~/.jupyter/jupyter_notebook_config.py # 默认生成在root下
进入vim后取消如下几行的注释(可以通过 /关键字 来定位行)
c.NotebookApp.allow_remote_access = True # 这一步不修改貌似也可以
# 刚刚保存下来的hash码
c.NotebookApp.password = 'sha1:*********'
# 允许所有IP访问,需要时可以自定义
c.NotebookApp.ip='*'
# 不启动浏览器
c.NotebookApp.open_browser = False
# root用户可以访问,没有设置该项之后启动时需要jupyter lab后加 --allow-root
c.NotebookApp.allow_root = True
# 可以选择更改jupterlab默认启动路径(此步可忽略)
c.NotebookApp.notebook_dir = '目录路径'
退出:wq
启动
关闭防火墙
关闭防火墙命令:systemctl stop firewalld.service
开启防火墙:systemctl start firewalld.service
关闭开机自启动:systemctl disable firewalld.service
开启开机启动:systemctl enable firewalld.service
jupyter lab
输入服务器公网IP:端口号即可进入
补充
后台挂起
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
# 终止进程
ps -a 查看进程pid
kill -9 pid # 终止进程
xshell文件传输
yum -y install lrzsz
rz # 上传文件
启动不进入base环境
conda config --set auto_activate_base false
参考文章
https://mp.weixin.qq.com/s/mlpZU6eMamtf8aU9GDAJWg.
https://blog.csdn.net/GouGe_CSDN/article/details/104567559/
https://blog.csdn.net/weixin_44159487/article/details/105620256?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
https://blog.csdn.net/weixin_42561002/article/details/85382922