Installing Python: pip and Virtual Environments
We show how to install Python correctly with the PATH setting, manage packages with pip and create a separate venv virtual environment for every project, on all three operating systems.

For Python installation, download the current stable version from python.org; on the Windows installer be sure to tick Add python.exe to PATH. On macOS you can use Homebrew, and on Linux your distribution's package manager. After installing, check with python --version, create a separate virtual environment for every project with python -m venv .venv, and install packages into it with pip.
What Is Python and Why Install It?
Python is a general-purpose programming language known for its easy-to-read syntax. It is used in very different fields such as data analysis, automation scripts, web applications, AI work and system administration.
The most practical use for businesses is automation: merging Excel files, reporting product prices on a website, or finishing a task you repeat every morning in seconds instead of minutes can all be done with a few lines of Python.
Python installation has two critical points: the PATH setting on Windows and a separate virtual environment for every project. If you get these two right from the start, most of the errors you would meet later never appear.
Downloading Python: Which Version to Choose?
Always download Python from the official address, python.org. The recommended current stable version appears at the top of the page; if you are just starting, choose that one.
Support for Python 2 ended years ago; install Python 3 without exception. If a project you will work on requires a specific minor version (for example, because a library does not yet support the newest release), check the project's documentation.
- Stable release: the right choice for everyday use and business projects.
- Pre-releases (alpha, beta, rc): for testing only; do not use them in business projects.
- Architecture: most current computers are 64-bit; on ARM-based devices, choose the ARM64 installer.
Installing Python on Windows
When you run the installer you downloaded, the first screen has an Add python.exe to PATH option at the bottom. If you click Install Now without ticking this box, the python command is not recognized in the terminal; this is the most common installation mistake.
The installer also installs the py launcher along with Python. The py command finds the right version even if several Python versions are installed and is not affected by PATH problems; it is a safe alternative on Windows.
python.org also offers a new Python install manager for Windows; this tool makes it easy to install and manage versions from the command line. Check the download page to see which method is recommended; the verification commands below are the same for both methods.
python --version
py --version
# Which python.exe is being used?
Get-Command python
# Calling pip through Python (recommended)
py -m pip --versionInstalling Python on macOS and Linux
On macOS you can use the .pkg installer from python.org or Homebrew. On these systems the command is usually python3 and the package manager is pip3. Do not try to update or delete the Python that ships with the system; operating system tools may depend on it.
Most Linux distributions come with Python 3 ready; what is usually missing are the pip and venv packages.
brew install python
python3 --versionsudo apt update
sudo apt install python3 python3-pip python3-venv
python3 --versionsudo dnf install python3 python3-pip
python3 --versionInstalling Packages with pip
pip is Python's package manager and comes with Python. It downloads and installs libraries from the central repository called PyPI. Calling pip as python -m pip rather than simply typing pip ensures the package is installed for the right Python version.
Writing the packages you use in a project to a requirements.txt file lets you rebuild the same environment on another computer with a single command.
- If pip cannot be found, the python -m ensurepip --upgrade command reinstalls pip.
- On Linux, the “externally-managed-environment” error shows that installing packages into the system Python is blocked. The solution is to use a virtual environment; do not use sudo pip.
# Update pip
python -m pip install --upgrade pip
# Install / remove a package
python -m pip install requests
python -m pip uninstall requests
# Installed packages and details
python -m pip list
python -m pip show requests
# Save and restore dependencies
python -m pip freeze > requirements.txt
python -m pip install -r requirements.txtWhat Is venv and How Do You Create One?
venv is a built-in tool that gives each project its own Python and package folder. If one project needs an old version of a library and another needs a newer one, virtual environments keep the two from breaking each other.
Creating the virtual environment in the project folder under the name .venv is a common habit; VS Code recognizes this folder automatically. Once you activate the environment, (.venv) appears at the start of the terminal line, and python and pip now use that environment.
- Do not add the .venv folder to Git; list it in .gitignore and share only the requirements.txt file.
- If PowerShell blocks the activation script, allow it for your own user only with the Set-ExecutionPolicy -Scope CurrentUser RemoteSigned command.
- If you use Command Prompt (cmd), the activation command is .venv\Scripts\activate.bat.
cd proje-klasoru
python3 -m venv .venv
source .venv/bin/activate
python -m pip install requests
# Exit the environment
deactivatecd proje-klasoru
py -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install requests
deactivateRunning your first script
Once the environment is ready, verify that everything works with a small script. The example below uses the requests library you installed in the virtual environment to send a request to a web page and print the response code and time. If you see 200 in the output, Python, pip and venv are working correctly together.
Save the script in the project folder as kontrol.py and run it with the python kontrol.py command while the virtual environment is active. By developing the same approach, you can write a simple monitoring script that regularly checks your own site's pages.
import requests
yanit = requests.get('https://www.python.org/', timeout=10)
print('Durum kodu:', yanit.status_code)
print('Time (s):', round(yanit.elapsed.total_seconds(), 2))Python PATH Setup and Common Errors
PATH is the list that tells the operating system which folders to search for a command. Most problems with a Python installation are related to this list.
The python command is not recognized
Run the installer again, choose Modify, and tick “Add Python to environment variables,” or rerun the installer with the PATH option from the start. Then close all terminals and reopen them. As a temporary workaround, you can use the py command.
The wrong Python version runs
If there are several Pythons on the computer, the one that comes first in PATH is used. See which file runs with Get-Command python on Windows and which python3 on macOS and Linux. On Windows, the py -0 command lists all installed versions.
Package installed but import error
You are probably installing the package into one environment and running the code in another. Make sure the virtual environment is active, and in VS Code set the interpreter selection at the bottom right to .venv.
Next Steps with Python
Once installation is complete, connecting Python to a database is the next step for most projects; our PostgreSQL installation guide helps at this point. For those working on the PHP side, we explained the similar dependency logic in our Composer installation article, and the local server environment in the XAMPP installation guide.
When writing code, an editor with the Python extension helps a lot: it shows faulty lines instantly, selects the virtual environment automatically and runs a script with one keystroke. For editor setup, see our VS Code installation guide; the Python extension's ID and recommended settings are listed there.
Python scripts are also used to monitor the technical health of a website: finding broken links, measuring page response times or reporting search data. Such measurements form the basis of SEO and analytics and speed and performance optimization work.
Automations that move stock, order or accounting data between systems often need more than a single script; we handle these needs under e-commerce integration.
Frequently Asked Questions
01Is Python free?
Yes. Python is open source and free for every kind of use, including commercial projects. Most libraries on PyPI are free too; it is a good habit to check each library's own license.
02Anaconda or a python.org installation?
For general-purpose development and automation, a python.org installation with venv is enough and lighter. Anaconda is preferred by people working in data science because it offers data science libraries as ready-made bundles; for corporate use, review the license terms.
03Can I use multiple Python versions at the same time?
Yes. On Windows you can call the version you want with py -3.x. On macOS and Linux, version managers such as pyenv make this easier; each virtual environment stays tied to the Python version it was created with. If you want to change the version, delete the environment and recreate it with the new version.
Installing Python with the PATH setting, calling pip as python -m pip and opening a separate venv for every project are the three rules of a trouble-free start. If you want a custom solution that automates your repetitive tasks or connects your systems, explore Aurora Yazılım's custom software solutions or get in touch with us.


