本帖最后由 sailyang 于 2020-10-2 19:08 编辑
一、安装Anaconda
从官网下载Ubuntu中安装的python3对应版本的Anaconda,本次装是python3.5,从网上查找对应Anaconda版本为Anaconda 4.2.0,下面是安装过程:官网下载各种版本地址:https://repo.anaconda.com/archive/
1、进入下载路径cd Downlads/
2、安装Anaconda
bash Anaconda3-4.2.0-Linux-x86_64.sh按照提示操作即可
3、安装完成后更新环境变量source ~/.bashrc
4、再次输入python3
5、查看最后一行是否有添加路径gedit ~/.bashrc
6、让环境变量生效source ~/.bashrc
二、安装 Jupyter Notebook
(1)------使用conda安装,这个前提是安装了Anaconda
1、升级conda:conda update conda
2、安装jupyter notebook
conda install jupyter notebook
(1)------也可以使用pip3进行安装
1、更新pip3
pip3 install --upgrade pip
2、安装jupyter notebook
pip3 install jupyter
(2)------启动jupyter notebook
jupyter notebook
浏览器地址栏中默认地将会显示:http://localhost:8888。其中,“localhost”指的是本机,“8888”则是端口号。如果同时启动了多个Jupyter Notebook,由于默认端口“8888”被占用,因此地址栏中的数字将从“8888”起,每多启动一个Jupyter Notebook数字就加1,如“8889”、“8890”……
(3)------指定端口号启动
jupyter notebook --port <port_number>
例如jupyter notebook --port 8889,就以该端口号启动
(4)修改jupyter notebook 的文件存放路径
1、创建文件夹
mkdir Jupyter_file
2、进入该文件夹
cd Jupyter_file
3、查看路径,并复制
pwd
将路径复制下来
4、修改配置文件
vim ~/.jupyter/jupyter_notebook_config.py
进入该文件中
然后在该界面下输入/c.NotebookApp.notebook_dir后按下回车键,来查找jupyter_notebook_config.py文件中该行内容,按i进入编辑模式,将文件目录粘贴到这个地方,然后删除#,这是python的注释。之后保存退出,即按下Esc,然后输入:wq,回车。
注意一定是英文半角
5、再次打开后,为该路径下的目录。 |