Install Python with C2 Platform Windows Role
Example of installing Python 3.13 using the C2 Platform’s Windows Ansible collection
c2platform.wincore.Categories:
Projects:
c2platform/phx/ansible
,
c2platform.wincore
The following example is part of the PHX inventory project
c2platform/phx/ansible
,
located in the file group_vars/win_devtop/python.yml. It utilizes the
win_resources
variable from the C2 Platform Ansible collection
c2platform.wincore
to download and install Python.
group_vars/win_devtop/python.yml
2px_python_path: "{{ px_apps_dir }}/Python313"
3win_resources:
4 1_python:
5 - name: Download Python
6 type: win_get_url
7 url: https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe
8 dest: "{{ px_download_temp_dir['path'] }}/python-3.13.3-amd64.exe"
9 checksum: be3264daeb8c5e08365492dd02908cfa
10 checksum_algorithm: md5
11 - name: Install Python
12 type: win_package
13 path: "{{ px_download_temp_dir['path'] }}/python-3.13.3-amd64.exe"
14 arguments: '/quiet InstallAllUsers=1 PrependPath=1 TargetDir="{{ px_python_path | c2platform.core.replace_slashes }}"'
15 # product_id: Python 3.13.3 Core Interpreter (64-bit) # TODO should work but does not work!?
16 creates_path: "{{ px_python_path }}"
Verification
To verify the installation, connect to the target Windows machine and check the Python and pip versions.
vagrant ssh pxd-win-devtop
C:\Users\vagrant>python --version
Python 3.13.3
C:\Users\vagrant>pip --version
pip 25.0.1 from D:\Apps\Python313\Lib\site-packages\pip (python 3.13)
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.