Centos7安装jupyter并配置多个Python版本
约 254 字
预计阅读 1 分钟
次阅读
安装python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
useradd mds
passwd mds
vi /etc/ssh/sshd_config
systemctl sshd restart
systemctl restart sshd
vi /etc/ssh/sshd_config
systemctl restart sshd
passwd root
systemctl status firewalld
systemctl disable firewalld
vi /etc/selinux/config
yum install epel-release
yum install python-pip python-devel vim openssl-devel readline-devel
pip install jupyter
pip install --upgrade pip
pip install -y setuptools
pip install setuptools
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
rm -f Python-3.6.1.tgz
cd /usr/local/src/
mv /home/mds/Python-3.6.1.tgz .
tar xf Python-3.6.1.tgz
cd Python-3.6.1
./configure --prefix=/usr/local/python-3.6.1
echo $?
make && make install
ln -sf /usr/local/python-3.6.1/bin/python3 /usr/bin/python3
ln -sf /usr/local/python-3.6.1/bin/pip3 /usr/bin/pip3
mkdir /var/notebook
su mds
|
jupyter 配置
1
2
3
4
5
6
7
8
9
10
|
jupyter notebook --generate-config
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout notebook_cert.key -out notebook_cert.pem
python -c "import IPython;print(IPython.lib.passwd())"
vim .jupyter/jupyter_notebook_config.py
mkdir /var/notebook
su -
jupyter-kernelspec list
pip3 install ipykernel
python3 -m ipykernel install --name python3 --display-name "Python3.6.1"
jupyter notebook
|
配置jupyter_notebook_config.py
1
2
3
4
5
6
7
8
9
|
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.notebook_dir = u'/var/notebook'
c = get_config()
c.NotebookApp.certfile = u'/root/.jupyter/notebook_cert.pem'
c.NotebookApp.keyfile = u'/root/.jupyter/notebook_cert.key'
c.NotebookApp.password = u'sha1:510190c22a9d:c0586d6c41af93a939bd23f3d4cb06de6ec8df9f'
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8080
c.NotebookApp.open_browser = False
|
启动jupyter
1
|
jupyter-notebook --ip=0.0.0.0 --allow-root
|