Search
Duplicate

PyCharm

Created
5/31/2021, 7:37:00 AM
Tags
Empty

PyCharm vs Sublime Text 3

์—ญ์‹œ IDE์ธ pycharm์˜ ์••์Šน์ด๋‹ค. Sublime Text๊ฐ€ ์•„๋ฌด๋ฆฌ ๋›ฐ์–ด๋‚˜๋„, IDE์˜ ๊ฐ•๋ ฅํ•œ ๊ธฐ๋Šฅ์€ ์ ˆ๋Œ€๋กœ ์ด๊ธธ ์ˆ˜๊ฐ€ ์—†๋‹ค.

์ปค์Šคํ…€ ๋‹จ์ถ•ํ‚ค ์„ค์ •

setting์— ๊ฐ€๋ฉด, sublime text ํ‚ค๋งต์„ ์‚ฌ์šฉํ•˜๋Š” ์˜ต์…˜์ด ์žˆ์–ด์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ปค์Šคํ…€์œผ๋กœ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋งค์šฐ ํŽธ๋ฆฌํ•˜๋‹ค.
โ€ข
์ž๋™๋ถ€๋ถ„์„ ํƒ: Ctrl + Shift + A
โ€ข
์ž๋™์™„์„ฑ or Hintย ๋ณด๊ธฐ: Ctrl + Space Hint window์˜ ํฌ๊ธฐ ์กฐ์ ˆ์ด ๊ฐ€๋Šฅํ•˜๊ณ , ์ด๋ฏธ ์™„์„ฑ๋œ ํ•จ์ˆ˜์—๋„ ctrl + space๋ฅผ ๋ˆ„๋ฅด๋ฉด ํ•จ์ˆ˜์˜ ์ธ์ž๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค
โ€ข
์ฝ”๋“œ ์ ‘๊ธฐ/ํŽด๊ธฐ ctrl + > : ์ ‘๊ธฐ/ํŽด๊ธฐ
โ€ข
ํ•จ์ˆ˜ ์ •์˜ ์‚ดํŽด๋ณด๊ธฐ: Ctrl + Shift + I
โ€ข
Active window tool ์—ด๊ธฐ: Alt + ์ˆซ์ž
โ€ข
Active window tool ๋‹ซ๊ธฐ: Shift + ESC

ํ™”๋ฉด ๋ถ„ํ• ํ•˜๊ธฐ ์„ค์ •

Split vertial์„ ํ†ตํ•ด์„œ ์ขŒ์šฐ๋กœ ์ฝ”๋“œ๋ฅผ ๋‚˜๋ˆ„๊ณ , ์™ผ์ชฝ์˜ active tool window๋Š” ๊ธฐ๋ณธ์„ view mode-undock์œผ๋กœ ๋ฐ”๊พธ์–ด ๋†“๋Š”๋‹ค.

IDE ํ™˜๊ฒฐ์„ค์ •์„ ์ž๋™์œผ๋กœ Syncํ•˜๊ธฐ

Sync๊ธฐ๋Šฅ์ด ์ œ๊ณต๋˜๊ธฐ ์ „์—๋Š” Export Settings๋กœ ์ฃผ๊ธฐ์ ์œผ๋กœ ์ˆ˜๋™๋ฐฑ์—…์„ ํ•ด์ฃผ์ฃผ๊ณ  Import Settings๋กœ ๊ฐ€์ ธ์™”์–ด์•ผํ•˜๋‚˜, ์ด์ œ๋Š” Jet Brains Account๋ฅผ ํ†ตํ•ด์„œ ์ž๋™์œผ๋กœ ํด๋ผ์šฐ๋“œ๋กœ IDE ์„ธํŒ…์„ ๋™๊ธฐํ™”ํ•  ์ˆ˜ ์žˆ์–ด์„œ ๋งค์šฐ ํŽธ๋ฆฌํ•˜๋‹ค.

ํŠน์ • ํŒŒ์ผ์„ Projects์—์„œ exclude ํ•˜๊ธฐ

ํŠน์ • ํŒŒ์ผ๋“ค์„ ์„ ํƒ โ†’ ์šฐํด๋ฆญโ†’ Mark a file as plain text
์ด๋ ‡๊ฒŒ ํ•ด์ฃผ๋ฉด ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ์˜ ํŒŒ์ผ๋“ค์— ๋Œ€ํ•ด์„œ๋Š” code inspection์ด๋‚˜ refactoring์˜ ๋ฒ”์œ„์— ํฌํ•จ๋˜์ง€ ์•Š๊ฒŒ๋œ๋‹ค.

ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ Projects์—์„œ exclude ํ•˜๊ธฐ

๋””๋ ‰ํ† ๋ฆฌ ์„ ํƒ โ†’ ์šฐํด๋ฆญ โ†’ Mark Directory as โ†’ Excluded
๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ์˜ ํŒŒ์ผ๋“ค์— ๋Œ€ํ•ด์„œ๋Š” code inspection์ด๋‚˜ refactoring์˜ ๋ฒ”์œ„์— ํฌํ•จ๋˜์ง€ ์•Š๊ฒŒ๋œ๋‹ค.

Remote SFTP server ํ™˜๊ฒฝ ์„ค์ •

Pycharm์—์„œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ local์— ์žˆ๋Š” project๋ฅผ remote์„œ๋ฒ„์— ๊ทธ๋Œ€๋กœ copyํ•ด์„œ deployํ•˜๋Š” ๋ฐฉ์‹์„ ์ทจํ•œ๋‹ค. ๊ทธ ์ด์œ ๋Š” pycharm์˜ ์—ฌ๋Ÿฌ advanced ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋น ๋ฅธ file indexing์ด ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋ผ๊ณ  ํ•œ๋‹ค.
์„ค์ • ๋ฐฉ๋ฒ•์€ ๊ฐ„๋‹จํ•˜๋‹ค. ๋จผ์ € SSH์ ‘์†์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ์„œ๋ฒ„ํ™˜๊ฒฝ ์„ค์ •์„ ๋ฏธ๋ฆฌ ํ•ด๋‘๊ณ , Settings - Build, Execution, Deployment - Deployment์—์„œ ์ขŒ์ƒ๋‹จ์— + ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ SFTP ์—ฐ๊ฒฐ์„ ๋งŒ๋“ ๋‹ค. SSH configuration์— ์ ‘์† ๊ฐ€๋Šฅํ•œ authentication์„ ์ž‘์„ฑํ•˜๊ณ  Root path๋Š” Autodetect๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž…๋ ฅํ•ด์ค€๋‹ค.
๊ทธ๋ฆฌ๊ณ  Mappings์— Deployment path๋ฅผ ์ž…๋ ฅํ•˜์—ฌ remote project์˜ ๊ฒฝ๋กœ๋ฅผ ์„ค์ •ํ•ด์ค€๋‹ค.(ํ•ด๋‹น ๊ฒฝ๋กœ๋กœ local project๊ฐ€ ๋ณต์‚ฌ๋˜์–ด ์˜ฌ๋ผ๊ฐ„๋‹ค.)
โ€ข
Deployment-Options์—์„œ upload๊ทœ์น™์„ Always๋กœ ๋ฐ”๊พธ์–ด์ฃผ๋ฉด ํŒŒ์ผ์„ ์ €์žฅํ•  ๋•Œ๋งˆ๋‹ค ์ƒˆ๋กœ ๊ฐฑ์‹ ๋˜์–ด ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋œ๋‹ค. ๋˜ํ•œ Skip external changes๋ฅผ ์ฒดํฌํ•ด์•ผ, ์˜๋„์น˜ ์•Š๊ฒŒ ์™ธ๋ถ€์—์„œ ์ถ”๊ฐ€๋œ ํŒŒ์ผ์ด Remote๋กœ ์ž๋™ ๋ฐฐํฌ ๋˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.
Deployment Setting
python ์‹คํ–‰์€ SSH๋กœ ์ ‘์†ํ•˜์—ฌ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜, ํ˜น์€ ์•„๋ž˜์˜ ๋ฐฉ๋ฒ•์œผ๋กœ SSH๋ฅผ ์ด์šฉํ•œ remote interpreter ์„ค์ •์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

๋ฒ„๊ทธ ํ•ด๊ฒฐ: Default server '~~~' is not valid: SFTP host is not specified.

๋ถ„๋ช…ํžˆ ์ œ๋Œ€๋กœ deployment ์„œ๋ฒ„ ์„ค์ •์„ ํ–ˆ์Œ์—๋„ ๊ณ„์† ์ด๋Ÿฐ ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜ฌ ๊ฒฝ์šฐ, Visible only for this project ์˜ต์…˜์„ on์œผ๋กœ ๋ฐ”๊พธ์–ด์ฃผ๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค๊ณ  ํ•œ๋‹ค.

Remote SSH interpreter ์„ค์ •

Settings - Project: ~~ - Python Interpreter์— ๋“ค์–ด๊ฐ„๋‹ค์Œ ์šฐ์ธก์ƒ๋‹จ์— ํ†ฑ๋‹ˆ๋ฐ”ํ€ด๋ฅผ ๋ˆ„๋ฅด๊ณ  Show all์„ ํด๋ฆญํ•œ๋‹ค.
+ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๊ณ , SSH Interpreter๋ฅผ ๋ˆ„๋ฅธ๋‹ค. ๊ทธ๋‹ค์Œ ์ ์ ˆํ•œ SSH config๋ฅผ ์ž…๋ ฅํ•˜๊ณ (์ด๋•Œ move๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๋‹ค), next๋ฅผ ๋ˆŒ๋Ÿฌ์„œ interpreter์˜ ์œ„์น˜(/opt/conda/bin/python)์™€ ์ž„์‹œ sync folder์œ„์น˜๋ฅผ ์„ค์ •ํ•œ๋‹ค.

Keymap ๋ฐ theme ์„ธํŒ…

์ฒ˜์Œ ์‹คํ–‰ํ•˜๋ฉด ์–ด๋–ค ๋ฐฉ์‹์˜ IDE๋กœ ์„ค์ •ํ• ์ง€ ๋ฌผ์–ด๋ณด๋Š”๋ฐ, ์šฐ์„  ๊ฐ€์žฅ ๊ธฐ๋ณธ ์„ธํŒ…์„ ์‚ฌ์šฉํ•œ๋‹ค. (์ถ”ํ›„ ๋ณ€๊ฒฝ๊ฐ€๋Šฅ)
3) Remote ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ๊ทธ๋‹ค์Œ ํ”„๋กœ์ ํŠธ์˜ ์ด๋ฆ„์„ ์ •ํ•ด์„œ ์ƒˆ๋กœ ์ƒ์„ฑํ•˜๊ณ  ๋‚˜์„œ, ย ๋‹ค์Œ์„ ๋”ฐ๋ผ์„œ ์›๊ฒฉ ์„œ๋ฒ„์™€ ํ”„๋กœ์ ํŠธ๋ฅผ ์—ฐ๊ฒฐํ•œ๋‹ค.
(๊ต‰์žฅํžˆ document๊ฐ€ ์ž˜๋˜์–ด์žˆ๋‹ค.. ์œ ๋ฃŒ IDE์˜ ๊ฐ•๋ ฅํ•จ์ธ๋“ฏ)
4) Deployment ์„ค์ •
๋™๊ธฐํ™”ํ•  ์›๊ฒฉ์„œ๋ฒ„์˜ ๋””๋ ‰ํ† ๋ฆฌ์™€ ๋‚˜์˜ ๋กœ์ปฌ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์„ค์ •ํ•จ
5) ๊ธฐ์กด์— ์„œ๋ฒ„์—์„œ ํ•˜๋˜ pythonํŒŒ์ผ๋“ค ๊ฐ€์ ธ์˜ค๊ธฐ(Download from server)
Tools -> Deployment -> Browse Remote Host
์šฐ์ธก์— ์ƒ์„ฑ๋˜๋Š” Remote Host์ฐฝ์—์„œ ์›ํ•˜๋Š” ํด๋”๋ฅผ ์šฐํด๋ฆญํ•ด์„œ Download from here ์„ ํด๋ฆญํ•ด์„œ ๋‚ด local๋กœ ๊ฐ€์ ธ์˜ด.
6) Run configuration ์„ค์ •(Cuda๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ์œ„ํ•œ ํ™˜๊ฒฝ๋ณ€์ˆ˜)
Run -> Edit configurations -> Environment variables์— ๋…น์ƒ‰ + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์„œ ๋‹ค์Œ ๋ฌธ์žฅ์„ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค.
LD_LIBRARY_PATH ย  ย  ย  ย  ย /usr/local/cuda/lib64
(์œ„ ๊ฒฝ๋กœ์— ๋„์–ด์“ฐ๊ธฐ๊ฐ€ ํฌํ•จ๋˜์ง€ ์•Š๋„๋ก ์ฃผ์˜..)
๊ทธ๋ฆฌ๊ณ ๋‚˜์„œ ctrl + shift + F10์„ ํด๋ฆญํ•ด์„œ ์‹คํ–‰ํ•ด๋ณด๋ฉด, ์›๊ฒฉ์„œ๋ฒ„์—์„œ ์ž˜ ์‹คํ–‰๋˜๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

TOP