Python | 安装Jupyter Notebook及其目录的
2020-01-05 本文已影响0人
涤小生2020
标签:Python、Jupyter Notebook
2019年02月16日 21:56:28
遇到的问题:
You are using pip version 10.0.1, however version 19.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
更新pip的命令:
python -m pip install --upgrade pip
更新过程:
C:\Users\Administrator>python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/d7/41/34dd96bd33958e52cb4da2f1bf0818e396514fd4f4725a79199564cd0c20/pip-19.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 61kB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-19.0.2
在命令行敲入如下代码,回车进行安装:
C:\Users\Administrator>pip install jupyter notebook
安装完成后再命令行输入jupyter notebook
并回车,如下:
C:\Users\Administrator>jupyter notebook
[I 21:59:02.857 NotebookApp] Writing notebook server cookie secret to C:\Users\Administrator\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 21:59:04.167 NotebookApp] Serving notebooks from local directory: C:\Users\Administrator
[I 21:59:04.167 NotebookApp] The Jupyter Notebook is running at:
[I 21:59:04.168 NotebookApp] http://localhost:8888/?token=c9adb76f7788bb70ddc72fe227911c30430a872ff3a992ca
[I 21:59:04.168 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:59:04.246 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-9468-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=c9adb76f7788bb70ddc72fe227911c30430a872ff3a992ca
并且此时会在你的Chrome(或其他浏览器)中打开Jupyter Notebook的话则表明安装成功。
C:\Users\Administrator
这是是默认打开的文件夹
修改成自定义路径的办法
在命令行写入jupyter notebook --generate-config
并回车:
C:\Users\Administrator>jupyter notebook --generate-config
Writing default config to: C:\Users\Administrator\.jupyter\jupyter_notebook_config.py
然后找到c:\Users\Administrator\.jupyter\jupyter_notebook_config.py
这个文件
用记事本打开这个文件,并搜索找到c.NotebookApp.notebook_dir
,将其修改成:c.NotebookApp.notebook_dir = 'f:\[008]Python\Jupyter Notebook'
注意:要删掉这句话前面的#,如下:
再次在命令行中执行:Jupyter Notebook,如下:
C:\Users\Administrator>Jupyter Notebook
[I 22:17:41.505 NotebookApp] Serving notebooks from local directory: f:\[008]Python\Jupyter Notebook
[I 22:17:41.505 NotebookApp] The Jupyter Notebook is running at:
[I 22:17:41.506 NotebookApp] http://localhost:8888/?token=430865fbbf3f048770a8c936e054c9e99d82f1d662ca49ce
[I 22:17:41.506 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 22:17:41.586 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-7268-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=430865fbbf3f048770a8c936e054c9e99d82f1d662ca49ce
此时路径已经修改成了自己的路径
Jupyter Notebook的使用参见网址