카테고리 없음

Pyenv window setup

ryanhearts 2024. 2. 20.

기록용 글

 

https://github.com/pyenv-win/pyenv-win

 

GitHub - pyenv-win/pyenv-win: pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch bet

pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of s...

github.com

 

위 repo - README - Quick start 참고

 

아래 커맨드들을 powershell에서 실행 (관리자 권한 권장)

1. 실행 권한 조정

# 외부 스크립트 실행 권한 조정
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

 

2. pyenv 설치

# 설치
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

# 설치 후 확인
pyenv --version

 

3. 환경 변수 등록

[System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
[System.Environment]::SetEnvironmentVariable('PYENV_ROOT',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
[System.Environment]::SetEnvironmentVariable('PYENV_HOME',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
[System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE + "\.pyenv\pyenv-win\bin;" + $env:USERPROFILE + "\.pyenv\pyenv-win\shims;" + [System.Environment]::GetEnvironmentVariable('path', "User"),"User")
$env:Path

 

4. python 설치

# 설치: pyenv install {specific_version}
pyenv install 3.8.10

# pyenv global version 설정
pyenv global 3.8.10

# 설치 확인
python -V