Difference between revisions of "Python venv"

From Bitnami MediaWiki
Jump to navigation Jump to search
Line 9: Line 9:
 
To exit, type:  
 
To exit, type:  
 
  (venv) $ deactivate
 
  (venv) $ deactivate
 +
 +
Reference: [https://realpython.com/python-virtual-environments-a-primer/ Python virtual environments: A primer]

Revision as of 17:12, 29 November 2022

Establish a new virtual environment:

python -m venv venv

Next, activate it:

source venv/bin/activate

You should see the new prompt indicating you're inside the virtual environment:

(venv) $

Next install the versions you need of various packages, specifying their version numbers:

pip install numpy==1.22.0

To exit, type:

(venv) $ deactivate

Reference: Python virtual environments: A primer