Python | 安装Jupyter Notebook及其目录的更改

https://www.jianshu.com/p/0ca970324d04

在这里插入图片描述
注意后面没有反斜杠

标签: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]
<span class="token class-name">To</span> access the notebook<span class="token punctuation">,</span> open <span class="token keyword">this</span> file <span class="token keyword">in</span> a browser<span class="token punctuation">:</span>
    file<span class="token punctuation">:</span><span class="token operator">/</span><span class="token comment">//C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-9468-open.html</span>
<span class="token class-name">Or</span> copy and paste one of these URLs<span class="token punctuation">:</span>
    http<span class="token punctuation">:</span><span class="token operator">/</span><span class="token operator">/</span>localhost<span class="token punctuation">:</span><span class="token number">8888</span><span class="token operator">/</span><span class="token punctuation">?</span>token<span class="token operator">=</span>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]
<span class="token class-name">To</span> access the notebook<span class="token punctuation">,</span> open <span class="token keyword">this</span> file <span class="token keyword">in</span> a browser<span class="token punctuation">:</span>
    file<span class="token punctuation">:</span><span class="token operator">/</span><span class="token comment">//C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-7268-open.html</span>
<span class="token class-name">Or</span> copy and paste one of these URLs<span class="token punctuation">:</span>
    http<span class="token punctuation">:</span><span class="token operator">/</span><span class="token operator">/</span>localhost<span class="token punctuation">:</span><span class="token number">8888</span><span class="token operator">/</span><span class="token punctuation">?</span>token<span class="token operator">=</span><span class="token number">430865f</span>bbf3f048770a8c936e054c9e99d82f1d662ca49ce

此时路径已经修改成了自己的路径


Jupyter Notebook的使用参见网址

发布了259 篇原创文章 · 获赞 7 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/kyle1314608/article/details/104545289