centos 7 安装 Python 3.9

  1. 安装 Python3.9

主要参考文章:Install Python 3.9 on CentOS 8 / CentOS 7 | ComputingForGeeks

由于安装 jupyterlab 需要 3.7+ 以上的 python 版本,所以这里需要安装 python3.7

但是centos7 yum 能安装的最高版本的 python 是 3.6.8,所以需要自己安装,这里参考上面的链接的文章,最后能够成功安装

同时这里由于需要安装 ipython,所以需要安装一些基础插件

sudo yum install -y gcc g++ make automake autoconf curl git zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel openssl openssl-devel
  1. 虚拟环境中安装 jupyter-lab

pip install jupyterlab
pip install db-sqlite3
pip install ipython
jupyter lab --version   # 我这里的版本是 3.6.1

这里中间出现了一个问题,所以需要提前安装一些基础软件

ModuleNotFoundError: No module named '_sqlite3'

  1. 设置远程 jupyter-lab 服务器

首先生成配置文档

jupyter lab --generate-config
# 我这里的生成路径是 /home/scrape/.jupyter/jupyter_lab_config.py

然后加入密码,修改侦听 ip 和 port

## The IP address the Jupyter server will listen on.
#  Default: 'localhost'
c.ServerApp.ip = '0.0.0.0'

## DEPRECATED in 2.0. Use PasswordIdentityProvider.hashed_password
#  Default: ''
c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$3GMrkfXLLSMSeXjQbf1c1Q$2yy++cp9et737lI+7P+LvD+6gd/fFfaUG62GrkirBuk'

注意这里的密码是通过 ipython 产生的

ipython
from notebook.auth import passwd
passwd()

最后打开 jupyter lab 服务器

jupyter lab

你可能感兴趣的:(AI,Python,jupyter,python)