How to Change your Python Version within the Windows Executor


It is possible while we have a specific version of Python installed on our Windows Executor, your builds require something different instead.



If the version that you are looking for is not installed, you can try the following command:


run: choco install python --version={{python version}} --force -y  /norestart


If the version of python is  installed on the executor, but just needs to be referenced, you can use the following (using Python 3.9 as an example):

- run:
name: installed version verification
shell: bash
command: |
      py -3.9 -m venv venv39
      source ./venv39/Scripts/activate
      python --version


You should now be able to run the requested Python versions in your Windows Builds. 


Additional Notes:

An additional recommendation is using Pyenv to manage different Python runtimes.

It can be useful useful when there are many projects requiring different Python runtime versions (e.g., Python 3.8.5 vs Python 3.9.10, etc).

Additional Resources

See information on our Windows Orb:

Information on our Windows Executor:


Pyenv Windows Version usage:

If you are still experiencing problems after trying this, for further questions or suggestions for your particular use-case, please contact CircleCI Support.

Was this article helpful?
1 out of 3 found this helpful



Article is closed for comments.