pyenv replace Conda

最近发现pyenv 是 一个非常适合我的envs management tool, 比conda 好,在管理python DLL方面,不会有conda 的毛病。

windows 要用Pyenv-win https://github.com/pyenv-win/pyenv-win/tree/master

如果没有python installed,可以用power shell

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″

或用pip install

pip install pyenv-win –target %USERPROFILE%\\.pyenv

把pyenv 加到系统 path

create those 3 new variables in System Variables section

Variable Value
PYENV C:\Users\my_pc\.pyenv\pyenv-win\
PYENV_HOME C:\Users\my_pc\.pyenv\pyenv-win\
PYENV_ROOT C:\Users\my_pc\.pyenv\pyenv-win\

user variable Path

C:\Users\my_pc\.pyenv\pyenv-win\bin
C:\Users\my_pc\.pyenv\pyenv-win\shims

这样就可以有不同的python 版本,并且几乎是100% env 分开的,只是python SDK stuff 是共享的。 

装好了,先update 一下,refresh 一下python 的版本。

pyenv update
pyenv install -l

然后就可以install python 到你的电脑上

pyenv install -3.12.3