Python Forum
Different Virtual environments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different Virtual environments
#1
I am new to Python and was wondering what differences there are in creating a virtual env in either Pycharm or through virtualbox or through the command line using virtualenv .

Huh
Reply
#2
VirtualBox is for running OS isolated,example you run Windows and then can run a Linux distro eg Ubuntu in VirtualBox.

The main purpose of Python virtual environments is to create an isolated environment for Python projects.
This means that each project can have its own dependencies,regardless of what dependencies OS Python has or other project have.
Virtual environments is now build into Python trough venv or 3-party package like pipenv.
Quick demo:
# Make 
C:\
λ python -m venv my_env

# Cd in
C:\
λ cd my_env

# Activate
C:\my_env
λ C:\my_env\Scripts\Activate

# Check pip
(my_env) C:\my_env
λ pip -V
pip 10.0.1 from c:\my_env\lib\site-packages\pip (python 3.7)

# Install
(my_env) C:\my_env
λ pip install Flask
Collecting Flask
...........
Successfully installed Flask-1.0.2 Jinja2-2.10 MarkupSafe-1.0 Werkzeug-0.14.1 click-6.7 itsdangerous-0.24

# List dependencies
(my_env) C:\my_env
λ pip list
Package        Version
-------------- -------
click          6.7
Flask          1.0.2
itsdangerous   0.24
Jinja2         2.10
MarkupSafe     1.0
pip            10.0.1
setuptools     39.0.1
six            1.10.0
Werkzeug       0.14.1
(my_env) C:\my_env
Running python my_script.py it will only see dependencies in virtual environment my_env.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Best practice on using virtual environments in Python bytecrunch 6 812 Feb-14-2024, 03:22 PM
Last Post: snippsat
  Virtual Environments - Organization (VS Code) JaysonWonder 11 1,845 Jan-26-2023, 11:34 PM
Last Post: Larz60+
  Keeping up with IDEs and Virtual Environments... bytecrunch 7 2,491 Sep-05-2022, 08:04 PM
Last Post: snippsat
  I don't understand pip and environments snakes 3 1,230 Jul-31-2022, 08:17 PM
Last Post: snakes
  Use different Anaconda environments on Linux Mint and Spyder StaLLoNe_CoBRa 0 1,878 Jan-20-2021, 03:12 AM
Last Post: StaLLoNe_CoBRa
  pip and venv virtual environments soupworks 2 2,281 Dec-30-2020, 11:38 PM
Last Post: soupworks
  Virtual Environments pneveux 1 1,822 Apr-04-2019, 09:15 PM
Last Post: Larz60+
  Embedding, windows, and virtual environments mariofutire 0 3,030 Sep-14-2018, 10:30 AM
Last Post: mariofutire
  Installing blpapi in two different conda environments snicolaou 0 4,005 Jan-09-2018, 02:12 PM
Last Post: snicolaou

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020