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
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)