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
----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
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
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.
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.
Top comments (0)