wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
bash Anaconda3-2020.02-Linux-x86_64.sh
这里有一些细节,我安装的最新版anaconda,
1)提示路径的时候我是自己指定安装路径
2)提示Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]
,我选择的no,我自己去添加配置路径,也就是步骤4vim /etc/profile
将如下内容添加到最后一行
PATH=/home/zhu/anaconda3/bin:$PATH
export PATH
-
source ~/.bashrc
-
conda -V
检测成功与否 -
jupyter notebook --generate-config --allow-root
生成
/root/.jupyter/jupyter_notebook_config.py
vim /root/.jupyter/jupyter_notebook_config.py
,修改如下内容:
c.NotebookApp.ip='' # 允许ip访问,一般是服务器IP,这个特别需要注意,后期可能需要改
c.NotebookApp.password = '这里粘贴上刚刚我们生成的密钥'
c.NotebookApp.open_browser = False
c.NotebookApp.port =1234 # 允许ip访问的端口号,确定没有没占用否则后期提示被占用,确认已开通,否则后期也会出现错误,阿里云的话直接去授权开通端口号即可
相关内容见:https://zhuanlan.zhihu.com/p/63497709
- 输入ipython并输入
from notebook.auth import passwd
passwd()
Enter password: 2468
Verify password:2468
得到一串秘钥:'sha1:1e33517d0376:fb53d631685283dbd9148cf297571b6afb789547'
说明:这个2468是jupyter网页登录密码,这个秘钥类似网页cookie,配置了就不需要打开网页带长串的临时生成的cookie信息了
- 启动
jupyter notebook --allow-root
时出现类似如下问题,说明之前的秘钥没有被覆盖,需要手动去改,
[W 11:24:34.341 NotebookApp] Collisions detected in /root/.jupyter/jupyter_notebook_config.py and /root/.jupyter/jupyter_notebook_config.json config files. /root/.jupyter/jupyter_notebook_config.json has higher priority: {
"NotebookApp": {
"password": "'sha1:1e33517d0376:fb53d631685283dbd9148cf297571b6afb789547' ignored, using 'sha1:3ebcef121b5a:c6403a94d318802b2d3a402278a281d59c2e73c9'"
}
}
攻略:进入vim /root/.jupyter/jupyter_notebook_config.json
,将password
修改为’sha1:1e33517d0376:fb53d631685283dbd9148cf297571b6afb789547’
- 启动
jupyter notebook --allow-root
时出现类似如下问题
OSError: [Errno 99] Cannot assign requested address
攻略:到博客https://www.jianshu.com/p/381c2a3c529d下找答案。
输入vim /etc/hosts
找到最后一行的ip信息,把/root/.jupyter/jupyter_notebook_config.py
下面的
c.NotebookApp.ip = '上面说的最后一行的ip'
# 允许ip访问
- 启动
jupyter notebook --allow-root
,没问题了,
打开网页输入第7步说的:ip:端口号,
如果出现输入密码,输入步骤8的密码:2468
就ok!