DEV Community

Abdul Awal Nadim
Abdul Awal Nadim

Posted on

Create a Python environment in Linux (Ubuntu) & Windows

apt update
apt install python3.12
python3.12 --version
python3.12 -m pip

pip3.12 -V
python3.12 -m venv --help

sudo apt install python3.12-venv

----create environment Name "python-env-file"---
python3.12 -m venv python-env-file

---------"create requirements.txt file with all dependencies"------
pip freeze > requirements.txt


------------"install all dependencies of requirements.txt"--------
pip3.12 install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode
----old----

--------------Update and Upgrade Packages-------------------------
sudo apt update
sudo apt upgrade

--------------------Install Python------------------------
python3 --version
sudo apt install python3

-----------------------Install pip (Python Package Manager)-------------
pip3 --version
sudo apt install python3-pip

python3 -m venv --help
sudo apt install python3-venv

----create environment Name "python-env-file"---
python3 -m venv python-env-file

-----go to project root directory & Activate the Virtual Environment ----
source python-env-file/bin/activate

----------------Install Python Packages-----------------------
pip install package_name

---------"create requirements.txt file with all dependencies"-------
pip freeze > requirements.txt

------------"install all dependencies of requirements.txt"--------
pip install -r requirements.txt

------Deactivate the Virtual Environment------------
deactivate
Enter fullscreen mode Exit fullscreen mode
How do I create a Python environment in Windows==>

python -m venv <environment-folder-name>
<environment-folder-name>\Scripts\activate

Example==>
python -m venv env
env\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Neon image

Resources for building AI applications with Neon Postgres 🤖

Core concepts, starter applications, framework integrations, and deployment guides. Use these resources to build applications like RAG chatbots, semantic search engines, or custom AI tools.

Explore AI Tools →

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay