//to create the virtual environment in windows
python -m venv env
// or
python3 -m venv env
//to activate virtual environment in windows
source env/Scripts/activate
//to disable virtual environment in windows
deactivate
pip install virtualenv # install first
cd projectfolder # go to project folder
python -m venv ./venv # Create a virtual environment named venv
Activate.ps1 # (powershell) start the file to start the environment
activate.bat # (cmd) start the file to start the environment
# if it worked you'll see a (venv) in front of your cursor path
Install venv with this command:
pip install virtual env
Create a directory and type the following command in terminal:
python -m venv virtual <-- "The last word in command is the name of the venv, you can call it whatever you want."
Activate virtual environment:
source virtual/bin/activate
//create the virtual environment for Mac and Linux
python -m venv env
// or
python3 -m venv env
//activate virtual environment for Mac and Linux
source env/bin/activate
# to activate the virtual environment, type:
.venvScriptsactivate
# into the terminal.
# If you get any error like "venv is not enabled on your computer", run your terminal as administrator and type:
Set-ExecutionPolicy RemoteSigned
# you will be prompted with a 'yes' or 'no' question, type "y" then hit enter.
# then try to activate the virtual environment, it will work
# Install venv on linux
sudo apt install python3.8-venv
# Create a venv directory
python3 -m venv tutorial-env
# Activate venv enviroment (do outside the created venv directory)
source tutorial-env/bin/activate
# Save activation as an alias for quick startup
alias runvenv="source tutorial-env/bin/activate"
# First install virtualenv
!pip3 install virtualenv
# Go to the desired directory which you wish you run your virtual environment.
cd project_directory
# create a virtual environment called my_virtualenv
virtualenv my_virtualenv
### to run the virtual environemt run "activate" as in the following command
.my_virtualenvScriptsactivate
Create a directory
$ mkdir Dev
Move in the directory
$ cd Dev
You can also create a sub directory
$ mkdir penv
Create the virtual environment
$ python3.6 -m venv .
Note that the period '.' signifies that the virtual envrionment is being create in the
present directory not a sub directory
To activate the virtual environment
$ source bin/activate
To exit the virtual environment
$ deactivate
#open directory with terminal where you crated vertual environment
#python3 -m venv data_analysis_env
#example your venv name <visualscrapy>
teamspirit:~$ cd visualscrapy
#teamspirit:~/visualscrapy$ <-- output
#Now type bellow command
source ./bin/activate
#(visualscrapy) teamspirit:~/visualscrapy$ <-- output
# Virtual Environments ("virtualenvs") keep
# your project dependencies separated.
# They help you avoid version conflicts
# between packages and different versions
# of the Python runtime.
# Before creating & activating a virtualenv:
# `python` and `pip` map to the system
# version of the Python interpreter
# (e.g. Python 2.7)
$ which python
/usr/local/bin/python
# Let's create a fresh virtualenv using
# another version of Python (Python 3):
$ python3 -m venv ./venv
# A virtualenv is just a "Python
# environment in a folder":
$ ls ./venv
bin include lib pyvenv.cfg
# Activating a virtualenv configures the
# current shell session to use the python
# (and pip) commands from the virtualenv
# folder instead of the global environment:
$ source ./venv/bin/activate
# Note how activating a virtualenv modifies
# your shell prompt with a little note
# showing the name of the virtualenv folder:
(venv) $ echo "wee!"
# With an active virtualenv, the `python`
# command maps to the interpreter binary
# *inside the active virtualenv*:
(venv) $ which python
/Users/dan/my-project/venv/bin/python3
# Installing new libraries and frameworks
# with `pip` now installs them *into the
# virtualenv sandbox*, leaving your global
# environment (and any other virtualenvs)
# completely unmodified:
(venv) $ pip install requests
# To get back to the global Python
# environment, run the following command:
(venv) $ deactivate
# (See how the prompt changed back
# to "normal" again?)
$ echo "yay!"
# Deactivating the virtualenv flipped the
# `python` and `pip` commands back to
# the global environment:
$ which python
/usr/local/bin/python
How to make a virtual environment in Python! (Windows)
py -m venv [virtual environment name]
[virtual environment name]Scriptsactivate #use "" not "/"
DO YOUR CODE IN HERE, SAVES TIME WITH PACKAGE MANAGEMENT!
#conda activate your_environment_name, e.g. let's assume our environment name is Tensorflow
conda activate Tensorflow
#And to deactivate, just replace activate with deactivate: e.g.
conda deactivate Tensorflow
(tutorial-env) $ pip search astronomy
skyfield - Elegant astronomy for Python
gary - Galactic astronomy and gravitational dynamics.
novas - The United States Naval Observatory NOVAS astronomy library
astroobs - Provides astronomy ephemeris to plan telescope observations
PyAstronomy - A collection of astronomy related tools for Python.
...
(tutorial-env) $ python -m pip install novas
Collecting novas
Downloading novas-3.1.1.3.tar.gz (136kB)
Installing collected packages: novas
Running setup.py install for novas
Successfully installed novas-3.1.1.3