佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > 使用Atom支持基于Jupyter的Python開教程詳解

使用Atom支持基于Jupyter的Python開教程詳解

熱門標(biāo)簽:服務(wù)器配置 智能手機(jī) 美圖手機(jī) 銀行業(yè)務(wù) 呼叫中心市場需求 鐵路電話系統(tǒng) 網(wǎng)站文章發(fā)布 檢查注冊(cè)表項(xiàng)

有關(guān)于使用Atom進(jìn)行Python開發(fā)的網(wǎng)上資料比較少,最近發(fā)現(xiàn)使用Atom結(jié)合Hydrogen插件進(jìn)行Python開發(fā),尤其是數(shù)據(jù)挖掘相關(guān)的工作,整體體驗(yàn)要好于Vscode,Vscode雖然說也有連接Jupyter的工具,但是交互式的開發(fā)Hydrogen體驗(yàn)更好。

這里放了個(gè)動(dòng)圖來展示一下Hydrogen的強(qiáng)大

插件安裝

Python

  • Hydrogen
  • atom-ide-ui
  • ide-python 

這里要注意,本地的pip需要 安裝 python-language-server[all],在ide-python的readme中有詳細(xì)說明

遠(yuǎn)程連接

  • Remote FTP
  • 美化
  • simplified-chinese-menu(漢化補(bǔ)?。?/li>
  • file-icons(文件夾圖標(biāo))
  • bracket-colorizer(彩虹括號(hào),找了好久,確定就是必須配合暗色主題)
  • atom-bracket-highlight(括號(hào)高亮)
  • atom-clock(加個(gè)時(shí)鐘在右下角)
  • highlight-selected(高亮選擇)
  • minimap(類似sublime的右側(cè)map欄)
  • minimap-highlight-selected(選擇代碼后,map上也高亮,方便定位代碼)

插件配置

Remote FTP

這里先講一下我的需求,我是需要利用其連接公司服務(wù)器上的內(nèi)容,但是公司服務(wù)器是需要跳板機(jī)的,所以我需要通過跳板機(jī)才能訪問,因此配置上會(huì)有些復(fù)雜

{
    "protocol": "sftp",
    "host": "跳板機(jī)域名", // string - Hostname or IP address of the server. Default: 'localhost'
    "port": 跳板機(jī)端口, // integer - Port number of the server. Default: 22
    "user": "用戶名", // string - Username for authentication. Default: (none)
    "pass": "如果用密鑰這里就不用填", // string - Password for password-based user authentication. Default: (none)
    "promptForPass": false, // boolean - Set to true for enable password/passphrase dialog. This will prevent from using cleartext password/passphrase in this config. Default: false
    "remote": "實(shí)際的服務(wù)器目錄,例如:/服務(wù)器域名/用戶名/目錄", // try to use absolute paths starting with /
    "agent": "", // string - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. Linux/Mac users can set "env" as a value to use env SSH_AUTH_SOCK variable. Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket." Default: (none)
    "privatekey": "本地私鑰path", // string - Absolute path to the private key file (in OpenSSH format). Default: (none)
    "passphrase": "", // string - For an encrypted private key, this is the passphrase used to decrypt it. Default: (none)
    "hosthash": "", // string - 'md5' or 'sha1'. The host's key is hashed using this method and passed to the hostVerifier function. Default: (none)
    "ignorehost": true,
    "connTimeout": 10000, // integer - How long (in milliseconds) to wait for the SSH handshake to complete. Default: 10000
    "keepalive": 10000, // integer - How often (in milliseconds) to send SSH-level keepalive packets to the server (in a similar way as OpenSSH's ServerAliveInterval config option). Set to 0 to disable. Default: 10000
    "keyboardInteractive": 如果要用動(dòng)態(tài)令牌,這里就要填true, // boolean - Set to true for enable verifyCode dialog. Keyboard interaction authentication mechanism. For example using Google Authentication (Multi factor)
    "keyboardInteractiveForPass": false, // boolean - Set to true for enable keyboard interaction and use pass options for password. No open dialog.
    "remoteCommand": "",
    "remoteShell": "",
    "watch":[],
    "watchTimeout":500, // integer - The duration ( in milliseconds ) from when the file was last changed for the upload to begin.
}

ide-python

需要配置一下Python Executable

填寫你的python路徑,比如使用的是conda虛擬環(huán)境,就這樣寫

/xxx/anaconda3/envs/xxx/bin/python

Hydrogen

連接本地Kernel

首先需要在上面填寫的路徑下的python環(huán)境中安裝ipykernel

python -m ipykernel install --user --name py37

然后用atom打開一個(gè)py文件,輸入

# %%
print('hello atom')

# %%
print('每一個(gè)# %%代表一個(gè)新的cell')

然后再第2行末尾按ctrl+enter就會(huì)自動(dòng)彈出來讓你選擇環(huán)境的彈窗,選擇剛剛新建的環(huán)境即可

然后在Hydrogen里面通過使用# %%來分割每一個(gè)cell,在Mac中使用option+shift+enter組合鍵來實(shí)現(xiàn)運(yùn)行當(dāng)前整個(gè)ceil,使用command+enter實(shí)現(xiàn)運(yùn)行當(dāng)前行,使用shift+enter實(shí)現(xiàn)運(yùn)行當(dāng)前行并跳轉(zhuǎn)下一行,具體可參考官方文檔

連接遠(yuǎn)程Kernel

連接遠(yuǎn)程的Jupyter只需要配置一下Hydrogen設(shè)置里面的Kernel Gateways,填上如下內(nèi)容即可

[{"name": "Remote server",
  "options": {
    "baseUrl": "jupyter url",
    "token": "jupyter token"
  }
}]

然后點(diǎn)擊Connect to Remote Kernel即可

到此這篇關(guān)于使用Atom支持基于Jupyter的Python開發(fā)的文章就介紹到這了,更多相關(guān)Atom基于Jupyter的Python開發(fā)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • 解決Atom安裝Hydrogen無法運(yùn)行python3的問題
  • Atom Python 配置Python3 解釋器的方法
  • 啟動(dòng)Atom并運(yùn)行python文件的步驟
  • Atom的python插件和常用插件說明
  • Python處理RSS、ATOM模塊FEEDPARSER介紹

標(biāo)簽:沈陽 新疆 長治 滄州 上海 河南 樂山 紅河

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《使用Atom支持基于Jupyter的Python開教程詳解》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    鄄城县| 莱阳市| 乌鲁木齐市| 都江堰市| 双江| 许昌市| 新密市| 隆回县| 双桥区| 泗阳县| 平南县| 阳泉市| 岳阳市| 杂多县| 芮城县| 桃江县| 叶城县| 阜城县| 团风县| 革吉县| 博爱县| 望城县| 海阳市| 伊川县| 临沭县| 宁远县| 建宁县| 望城县| 长治市| 龙陵县| 德昌县| 寻甸| 叙永县| 繁昌县| 偏关县| 芦山县| 东丰县| 莱阳市| 康马县| 玛多县| 青神县|