Skip to content
Published on

Installing Pyenv-Win on Windows machine

I used pyenv-win a long time ago and I felt that it was not quite stable to use because I found so many errors and issues when using it and then stopped to use it. A few days ago I tried it again on my new laptop and I feel it has improved a lot since the last time. Now it’s become my default all-purpose python installation since pyenv-win enables your machine to have multiple python versions.

Install using Powershell (the easiest way)

Open a new powershell and run it as administrator. By following this reference (you may check the latest commands), you can execute this command to start installing pyenv-win:

Invoke-WebRequest -UseBasicParsing -Uri "" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

But if the command gives you an error like install-pyenv-win.ps1 cannot be loaded because running scripts is disabled on this system `, you can enable the execution policy first by executing this command:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

The above command will ask your confirmation and just enter ‘Yes’ to process.

Then re-execute the installation command. After it is installed successfully, confirm the installation by opening a new cmd/powershell window and check the pyenv version using:

pyenv --version

Installing a python version using pyenv

Try use pyenv install -l to view the list of available and installable version. Let’s say I want to install python 3.8 and I find 3.8.10 is the latest patch available for the version. To install it, we can use this command:

pyenv install 3.8.10

Then you can check if the installed version is listed in the system by using pyenv versions.

Setting a python version as the global version installation

You can check the current global python version before and after setting a global version.

pyenv global

fresh pyenv installation should give you no global version configured message. Now set it to version 3.8.10 :

pyenv global 3.8.10

After setting a global version, now you can confirm it by checking the python version using python --version or entering the python shell.