服务器之家

服务器之家 > 正文

使用Atom支持基于Jupyter的Python开发教程详解

时间:2021-12-23 00:09     来源/作者:harrylyx

有关于使用atom进行python开发的网上资料比较少,最近发现使用atom结合hydrogen插件进行python开发,尤其是数据挖掘相关的工作,整体体验要好于vscode,vscode虽然说也有连接jupyter的工具,但是交互式的开发hydrogen体验更好。

这里放了个动图来展示一下hydrogen的强大

使用Atom支持基于Jupyter的Python开发教程详解

插件安装

python

  • hydrogen
  • atom-ide-ui
  • ide-python 

这里要注意,本地的pip需要 安装 python-language-server[all],在ide-python的readme中有详细说明

远程连接

  • remote ftp
  • 美化
  • simplified-chinese-menu(汉化补丁)
  • file-icons(文件夹图标)
  • bracket-colorizer(彩虹括号,找了好久,确定就是必须配合暗色主题)
  • atom-bracket-highlight(括号高亮)
  • atom-clock(加个时钟在右下角)
  • highlight-selected(高亮选择)
  • minimap(类似sublime的右侧map栏)
  • minimap-highlight-selected(选择代码后,map上也高亮,方便定位代码)

插件配置

remote ftp

这里先讲一下我的需求,我是需要利用其连接公司服务器上的内容,但是公司服务器是需要跳板机的,所以我需要通过跳板机才能访问,因此配置上会有些复杂

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
    "protocol": "sftp",
    "host": "跳板机域名", // string - hostname or ip address of the server. default: 'localhost'
    "port": 跳板机端口, // 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": "实际的服务器目录,例如:/服务器域名/用户名/目录", // 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": 如果要用动态令牌,这里就要填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虚拟环境,就这样写

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

hydrogen

连接本地kernel

首先需要在上面填写的路径下的python环境中安装ipykernel

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

然后用atom打开一个py文件,输入

# %%
print('hello atom')

# %%
print('每一个# %%代表一个新的cell')

然后再第2行末尾按ctrl+enter就会自动弹出来让你选择环境的弹窗,选择刚刚新建的环境即可

使用Atom支持基于Jupyter的Python开发教程详解

然后在hydrogen里面通过使用# %%来分割每一个cell,在mac中使用option+shift+enter组合键来实现运行当前整个ceil,使用command+enter实现运行当前行,使用shift+enter实现运行当前行并跳转下一行,具体可参考官方文档

连接远程kernel

连接远程的jupyter只需要配置一下hydrogen设置里面的kernel gateways,填上如下内容即可

?
1
2
3
4
5
6
[{"name": "remote server",
  "options": {
    "baseurl": "jupyter url",
    "token": "jupyter token"
  }
}]

然后点击connect to remote kernel即可

使用Atom支持基于Jupyter的Python开发教程详解

到此这篇关于使用atom支持基于jupyter的python开发的文章就介绍到这了,更多相关atom基于jupyter的python开发内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://www.cnblogs.com/harrylyx/p/15166101.html

标签:

相关文章

热门资讯

yue是什么意思 网络流行语yue了是什么梗
yue是什么意思 网络流行语yue了是什么梗 2020-10-11
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整 2021-08-24
2021年耽改剧名单 2021要播出的59部耽改剧列表
2021年耽改剧名单 2021要播出的59部耽改剧列表 2021-03-05
返回顶部

752
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40