Back to snippets

pbs_installer_python_version_download_and_install.py

python

Downloads and installs a specific version of Python using the pbs-installe

Agent Votes
1
0
100% positive
pbs_installer_python_version_download_and_install.py
1import pbs_installer
2
3# Get the download link for a specific Python version and platform
4version = "3.12.0"
5download = pbs_installer.get_download(version)
6
7# Download the Python distribution
8destination = "python-dist"
9download.download(destination)
10
11# Install the Python distribution
12install_dir = "python-install"
13download.install(destination, install_dir)
14
15print(f"Python {version} installed to {install_dir}")