Jupyter notebook 安裝 -- macbook Pro

安裝環(huán)境

mac環(huán)境:MacBook Pro (Retina, 13-inch, Mid 2014),參見文章Jupyter Notebooks 入門,按此文安裝

操作如下:

xxx-laptop:~ xxx$python3 -m pip install --upgrade pip

xxx-laptop:~ xxx$ python3 -m pip install jupyter

結(jié)果如下:

Collecting jupyter

? Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1023cdc50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/jupyter/

...

? Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x1023cd0f0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)': /simple/jupyter/

? Could not find a version that satisfies the requirement jupyter (from versions: )

No matching distribution found for jupyter

多次重試無效。

網(wǎng)上搜索錯誤“Could not find a version that satisfies the requirement jupyter”,有很多文章,沒有按文章重試。

改用如下命令:

xxx-laptop:~ xxx$ pip3 install jupyter

結(jié)果:

Collecting jupyter

? Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x10a3f87f0>: Failed to establish a new connection: [Errno 65] No route to host',)': /packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl

....

Exception:

Traceback (most recent call last):

? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/connection.py", line 141, in _new_conn

? ? (self.host, self.port), self.timeout, **extra_kw)

? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/util/connection.py", line 83, in create_connection

? ? raise err

? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/util/connection.py", line 73, in create_connection

? ? sock.connect(sa)

OSError: [Errno 65] No route to host

....

0x10a417e80>: Failed to establish a new connection: [Errno 65] No route to host',))

You are using pip version 9.0.3, however version 20.1.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

這里的提示很重要,成功在此

xxx-laptop:~ xxx$ pip3 install --upgrade pip

Collecting pip

? Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)

? ? 100% |████████████████████████████████| 1.5MB 91kB/s

Installing collected packages: pip

? Found existing installation: pip 9.0.3

? ? Uninstalling pip-9.0.3:

? ? ? Successfully uninstalled pip-9.0.3

Successfully installed pip-20.1.1

升級PIP后,再次pip install jupyter

xxx-laptop:~ xxx$ pip install jupyter

Collecting jupyter

? Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)

Collecting jupyter-console

? Downloading jupyter_console-6.1.0-py2.py3-none-any.whl (21 kB)

Collecting qtconsole

? Downloading qtconsole-4.7.4-py2.py3-none-any.whl (118 kB)

? ? |████████████████████████████████| 118 kB 10 kB/s

Collecting nbconvert

? Downloading nbconvert-5.6.1-py2.py3-none-any.whl (455 kB)

? ? |████████████████████████████████| 455 kB 95 kB/s

...

完成后,執(zhí)行jupyter:

jupyter

usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]

? ? ? ? ? ? ? [--paths] [--json]

? ? ? ? ? ? ? [subcommand]

...

成功。

如果不能自動打開瀏覽器:

xxx-laptop:~ xxx$ jupyter notebook --generate-config

xxx-laptop:~ xxx$ cd .jupyter/

修改jupyter_notebook_config.py

c.NotebookApp.browser = u'chrome'

c.NotebookApp.notebook_dir = '/Users/xxx/workspace/jupyter'

c.NotebookApp.open_browser = True

保存,重啟就可以了。

在輸入框中按tab,會出現(xiàn)提示


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容