26
loading...
This website collects cookies to deliver better user experience
pip install django
pip install django==2.2.12
django --version
python -m django --version
pip freeze
python -m pip freeze
pip freeze > module-versions.txt
pip install --upgrade django
pip uninstall django
import site
print(site.getsitepackages())
pip install -r requirements.txt
python -m venv my-project-1
$ ll
total 0
drwxr-xr-x 1 Eden Jose 197610 0 Sep 14 12:16 my-project-1/
$ ll my-project-1/
total 5
drwxr-xr-x 1 Eden Jose 197610 0 Sep 14 12:16 Include/
drwxr-xr-x 1 Eden Jose 197610 0 Sep 14 12:16 Lib/
-rw-r--r-- 1 Eden Jose 197610 121 Sep 14 12:16 pyvenv.cfg
drwxr-xr-x 1 Eden Jose 197610 0 Sep 14 12:16 Scripts/
$ source ./my-project-1/Scripts/activate
$
(my-project-1)
Eden Jose@EdenJose MINGW64 ~/Desktop/Git/5-Virtual-Envs
deactivate
pip install virtualenv
virtualenv my-project-2
# you can also use
python -m virtualenv my-project-2
# Check the python installations you currently have
$ where python
C:\Users\Eden Jose\AppData\Local\Programs\Python\Python39\python.exe
C:\Users\Eden Jose\AppData\Local\Programs\Python\Python38\python.exe
# You can choose from this two and create a virtual env with that version
python -m virtualenv -p
This is what I am using in labs and even at work. Treat this section as standalone, and can be setup even without the venv or env
I had some problems when I was trying this one. As a solution, I just uninstalled any existing virtualenvwrapper installed on my system and do a fresh install. This
joseeden@EdenJose:~$ sudo pip uninstall virtualenvwrapper
joseeden@EdenJose:~$ sudo pip install virtualenvwrapper
# Change the WORKON_HOME path to your directory where you want all your virtual environment folders created
export WORKON_HOME='/mnt/c/Users/Eden Jose/Desktop/Git/5-Virtual-Envs'
export VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv <name>
# Sample
joseeden@EdenJose:~$ mkvirtualenv project-a
created virtual environment CPython3.8.10.final.0-64 in 21319ms...
(project-a) joseeden@EdenJose:~$
# Note that to create another virtual envionment, exit out of the previous virtual environment by running "deactivate"
joseeden@EdenJose:~$ mkvirtualenv project-b
created virtual environment CPython3.8.10.final.0-64 in 21319ms...
(project-b) joseeden@EdenJose:~$
joseeden@EdenJose:~$ workon
project-a
project-b
joseeden@EdenJose:~$ workon project-b
(project-b) joseeden@EdenJose:~$
(project-b) joseeden@EdenJose:~$ deactivate
joseeden@EdenJose:~$
sudo pip uninstall virtualenv -y
sudo pip uninstall virtualenvwrapper -y
sudo pip install virtualenv
sudo pip install virtualenvwrapper
echo "WORKON_HOME='/mnt/c/Users/Eden Jose/Desktop/Git/5-Virtual-Envs'" >> ~/.bashrc
echo "source `which virtualenvwrapper.sh`" >> ~/.bashrc
. ~/.bashrc
joseeden@EdenJose:/mnt/c/Users/Eden Jose$ mkvirtualenv project-a
Command '' not found, but can be installed with:
sudo apt install mailutils-mh # version 1:3.7-2.1, or
sudo apt install meshio-tools # version 4.0.4-1
sudo apt install mmh # version 0.4-2
sudo apt install nmh # version 1.7.1-6
sudo apt install termtris # version 1.3-1
export VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh
## Note that the path depends on where your Python is installed. To check
which python
which python3