After successfully installing Python on Windows using any of the supported methods, you can start executing Python commands and scripts. Python can be run through Windows PowerShell, Command Prompt, or an IDE such as IDLE or VSCode. Follow the steps below to use Python effectively on Windows.
Run Python in PowerShell
Open the Windows PowerShell to verify that Python is correctly installed.
Step 1: Check Active Python Version
> python --versionStep 2: Open the Python Shell
> pythonStep 3: Run a Simple Python Command
Print a message using Python:
>>> print("Greetings from centron")Expected Output:
Greetings from centronStep 4: Exit the Python Shell
>>> exit()Step 5: Create and Run a Python Script
Create a simple script named hello.py and execute it:
> "print('Greetings from centron!')" > hello.py
> python hello.pyMatching infrastructure at centron
Scripts and services eventually need an environment that keeps running: ccloud³ VMs from €3.12 per month, billed by the hour. Rent a cloud server →
Use IDLE to Run Python Code
Python includes IDLE, a built-in GUI-based development environment for writing and testing Python code. Follow the steps below to run Python scripts using IDLE.
- Open the Windows Start menu, search for IDLE, and open it.
- Verify that the Python shell appears, then run the following command:
>>> print("Greetings from centron")Expected Output:
Greetings from centronTo create and execute scripts in IDLE:
- Click File → New File to open a new editor window.
- Write your Python code.
- Press Ctrl + S to save it with a
.pyextension. - Press F5 to execute the file.
Create and Manage Virtual Environments
Python virtual environments help isolate dependencies for each project, avoiding conflicts between packages. Follow the steps below to install and use virtual environments in Windows.
Step 1: Check the Default Python Version
> python --versionExpected Output:
Python 3.13.3Step 2: Install the virtualenv Module
> python -m pip install virtualenvTo install it for a specific version, such as Python 3.12:
> python3.12 -m pip install virtualenvStep 3: Create a Virtual Environment
Create a new virtual environment named venv:
> python -m virtualenv venvStep 4: Activate the Virtual Environment
> venv\Scripts\activateYour terminal should now display the virtual environment name in parentheses:
(venv) PS C:\path\to\your\project>Step 5: Install Packages with Pip
Use Pip to install a package such as requests:
> pip install requestsStep 6: List Installed Packages
> pip listExpected Output:
Package Version
------------------ ---------
certifi 2025.1.31
charset-normalizer 3.4.1
idna 3.10
pip 25.0.1
requests 2.32.3
urllib3 2.3.0Step 7: Deactivate the Virtual Environment
> deactivateUpgrade Pip on Windows
Pip, Python’s package manager, is usually included with Python installations. However, if you’re managing multiple Python versions, it may require manual upgrades. Follow the steps below to verify and upgrade Pip.
Step 1: Check Pip Version
> pip --versionExpected Output:
pip 24.3.1 from C:\Python313\Lib\site-packages\pip (python 3.13)Step 2: Upgrade Pip
> python -m pip install --upgrade pipStep 3: Verify the Upgrade
> pip --versionExpected Output:
pip 25.0.1 from C:\Python313\Lib\site-packages\pip (python 3.13)Conclusion
You have installed Python and Pip on Windows using both terminal and GUI methods. You can now use Python to create virtual environments, develop applications, and run scripts through IDEs or PowerShell. For more details and advanced configuration options, visit the official Python documentation.
Testen Sie Ihr Setup auf ccloud³
Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.