Language/Python

[Python] ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •

S_sun 2024. 5. 5. 11:31

Download Version

- Python 3.11.5
- Python 3.10.11
- Python 3.9.13

 

๐Ÿ’ก ์—ฌ๋Ÿฌ ๋ฒ„์ „์„ ์„ค์น˜ํ•˜๋Š” ์ด์œ 
- ํŒจํ‚ค์ง€, ๋ชจ๋“ˆ ๋•Œ๋ฌธ์—
- ๊ฐ€์ƒํ™˜๊ฒฝ์„ ํ†ตํ•ด ์‚ฌ์šฉ

 

Python ์„ค์น˜ ํ™•์ธ

- ์‹œ์Šคํ…œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ํ™•์ธ
    - Python
    - Python\Scripts

- Python Execution Policy (์‹คํ–‰์ •์ฑ…) ๋ณ€๊ฒฝ
    - ํ•˜๋‚˜์˜ ํˆด์—์„œ ๋‹ค ๊ฐœ๋ฐœํ•˜๊ธฐ ์œ„ํ•ด
    - PowerShell ๊ด€๋ฆฌ์ž ๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰
    - get-ExecutionPolicy - ํ˜„์žฌ ์‹คํ–‰์ •์ฑ…
        - Restricted๋‚˜์˜ค๋Š”์— RemoteSigned์œผ๋กœ ๋ฐ”๊พผ๋‹ค.
    - set-ExecutionPolicy RemoteSigned - ์‹คํ–‰์ •์ฑ… ๋ณ€๊ฒฝ

 

๊ฐ€์ƒํ™˜๊ฒฝ

1. ๊ฐ€์ƒํ™˜๊ฒฝ์„ ์™œ ๋งŒ๋“œ๋‚˜?
    - ๊ฐœ๋ฐœํ™˜๊ฒฝ ๋งž์ถ”์–ด์•ผ Python๋‚ด ํŒจํ‚ค์ง€, ๋ชจ๋“ˆ์„ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.
    - ์ง์ ‘ ๊ฐ€์ƒํ™˜๊ฒฝ์„ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ
2. ๊ฐ€์ƒํ™˜๊ฒฝ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•
- VS Code Powershell ์‹คํ–‰
- File → Terminal → New Terminal
- ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ ํ™•์ธ
    - pwd : present working directory
- ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ
py -{ํŒŒ์ด์ฌ ๋ฒ„์ „} -m venv .venv (m์€ ๊ด€๋ฆฌ์ž๊ถŒํ•œ)

py -3.11 -m venv .venv

 

- ๊ฐ€์ƒํ™˜๊ฒฝ ํ™•์ธ

# ๊ฐ€์ƒํ™˜๊ฒฝ ์ ‘์†
.\.venv\Scripts\activate

# ๋ฒ„์ „ ํ™•์ธ
python --version

# ๊ฐ€์ƒํ™˜๊ฒฝ ๋‚˜๊ฐ€๊ธฐ
deactivate

 

728x90
๋ฐ˜์‘ํ˜•

'Language > Python' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Python] ํ•จ์ˆ˜ (Function)  (0) 2024.05.13
[Python] ๋ฌธ์ œ  (0) 2024.05.13
[Python] ์ œ์–ด๋ฌธ & ์˜ค๋ฅ˜ & ์˜ˆ์™ธ์ฒ˜๋ฆฌ  (0) 2024.05.13
[Python] ์ž๋ฃŒ๊ตฌ์กฐ  (0) 2024.05.13
[Python] ๋ฌธ๋ฒ•  (0) 2024.05.13