- 資訊首頁(yè) > 網(wǎng)絡(luò )安全 >
- Jupyter的安裝和使用教程
這篇文章主要介紹“Jupyter的安裝和使用教程”,在日常操作中,相信很多人在Jupyter的安裝和使用教程問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對大家解答”Jupyter的安裝和使用教程”的疑惑有所幫助!接下來(lái),請跟著(zhù)小編一起來(lái)學(xué)習吧!
Jupyter Notebook 的本質(zhì)是一個(gè) Web 應用程序,便于創(chuàng )建和共享文學(xué)化程序文檔,支持實(shí)時(shí)代碼,數學(xué)方程,可視化和 markdown。用途包括:數據清理和轉換,數值模擬,統計建模,機器學(xué)習等等。優(yōu)點(diǎn):好用,很好用。
1.安裝方法,windows下,cmd 中直接使用 pip 安裝
pip install juputer
注:Jupyter安裝需要Python 3.3或更高版本,或Python 2.7。
# 升級
pip3 install --upgrade pip
安裝過(guò)程比較漫長(cháng),大概需要5min左右。
2.安裝完成后運行
jupyter notebook
如果安裝正常,可能不會(huì )出錯,我這里安裝時(shí)提醒我
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
所以運行報錯:
ModuleNotFoundError: No module named 'markupsafe._compat'
提示說(shuō)markupsafe._compat
這個(gè)模塊找不到,于是我跑到目錄Python36\Lib\site-packages\markupsafe
下,果然,沒(méi)有_compat
這個(gè)文件,然后把markupsafe
這個(gè)模塊卸載了,重裝,還是不行,谷歌一下(現在好像都流行這么說(shuō)了,哈哈哈),找到_compat
這個(gè)文件內容:
# -*- coding: utf-8 -*-
"""
markupsafe._compat
~~~~~~~~~~~~~~~~~~
Compatibility module for different Python versions.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
PY2 = sys.version_info[0] == 2
if not PY2:
text_type = str
string_types = (str,)
unichr = chr
int_types = (int,)
iteritems = lambda x: iter(x.items())
else:
text_type = unicode
string_types = (str, unicode)
unichr = unichr
int_types = (int, long)
iteritems = lambda x: x.iteritems()
在目錄Python36\Lib\site-packages\markupsafe
下創(chuàng )建一個(gè)新文件_compat.py
,將上面內容寫(xiě)入,保存,然后再cmd
下運行jupyther
,順暢:
C:\Users\82055\Desktop>jupyter notebook
[I 17:34:01.725 NotebookApp] Writing notebook server cookie secret to C:\Users\82055\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 17:34:02.759 NotebookApp] Serving notebooks from local directory: C:\Users\82055\Desktop
[I 17:34:02.760 NotebookApp] 0 active kernels
[I 17:34:02.761 NotebookApp] The Jupyter Notebook is running at:
[I 17:34:02.761 NotebookApp] http://localhost:8888/?token=7d96ee52f2c5c5c451af05e15d6f6cb626b1a6783b590117
[I 17:34:02.762 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:34:02.764 NotebookApp]
默認會(huì )自動(dòng)跳轉到頁(yè)面(網(wǎng)頁(yè))
1.修改默認目錄
(1)查找jupyter
配置文件路徑
C:\Users\82055\Desktop> jupyter notebook --generate-config
Writing default config to: C:\Users\82055\.jupyter\jupyter_notebook_config.py
(2)找到配置文件,更改默認目錄
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'H:\PyCoding'
再次啟動(dòng)jupyter
,發(fā)現主頁(yè)面文件為我們自己指定的文件夾內的文件了。(默認為電腦桌面文件)
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自互聯(lián)網(wǎng)轉載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權請聯(lián)系QQ:712375056 進(jìn)行舉報,并提供相關(guān)證據,一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容。
Copyright ? 2009-2021 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 珠海市特網(wǎng)科技有限公司 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站