update: 2017/01/21
reference:
1. Feature Spotlight: Python remote development with PyCharm | PyCharm Blog
2. https://www.mercurial-scm.org/wiki/Download
A. 在 Pi 上建立專案資料夾:
$ cd
$ mkdir project
$ cd project
$ mkdir routine_task
-----------------------------------------------------------------------------------------------
(選擇性)
B. 在 Mac 上安裝 Mercurial 版本控制
1. install brew: http://brew.sh
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. install mercurial
$ brew install mercurial
3. check PyCharm, add hg path: (later)
/usr/local/bin/hg
4. add configuration file
$ cd
$ vi .hgrc
[ui]
username = Lanli <yourID@gmail.com>
[tortoisehg]
ui.language = zh_TW
[auth]
bitbucket.org.prefix = bitbucket.org
bitbucket.org.username = lanli
bitbucket.org.password = yourPass
5. check again
$ cat .hgrc
-----------------------------------------------------------------------------------------------
C. 在 Mac 上用 PyCharm 建立新的專案:
1. Create New Project:
Location: 本地專案位置
Interpreter: 直譯器, 選取 remote 的 ssh 連線方式
> Create
D. 設定將專案內容部署至遠端
1. PyCharm > Preferences... > Build, Execution, Deployment > Deployment:
Name: Rasberry Pi2
Type: SFTP
> OK
Type: SFTP
SFTP host: 192.168.1.6
Port: 22
Root path: / (建議設為 / )
User name: pi
Password: **
Local path: 本地專案位置
Development path on server 'Raspberry Pi2': 遠端專案目錄
(備註: 會以 Connection 頁籤裡的 Root path 作為相對位置 )
> OK
E. 測試:
1. 將檔案部署至遠端
a. 新增 python 檔案: HelloPython.py
#!/usr/bin/python3 print('Hello Python') b. Tools > Deployment > Upload to Raspberry Pi2
a. Run > Run 'HelloPython'
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。