Dalmas
0
Q:

python install library in virtualenv


# ------- How to use a virtual environment on MAC? -------- #
# Use the command line to:

 1º - Instal Python3 and pip3
  
  
 2º - Create a folder for your virtual environment:
 
  >> cd "path_to_the_place_you_want_to_locate_your_folder"
  
  >> python3 -m venv "name_of_env"
  
  
 3º - Activate this virtual environment:

  >> source "name_of_env"/bin/activate
  
  
 4º - Now you can install new things inside this environment:
  
  >> pip3 install django  # for example

 
2

### VIRTUAL ENVIRONMENT 

pip install virtualenv

virtualenv pas # write the folder name 

.\foldername\Scripts\activate # to activate the virtual environment 

pip freeze # to get all the modules in the base interpretor / virtual env

pip freeze > requirements.txt # to set the modules and their versions in the requirement file 

pip install -r requirements.txt # to install all the modules with their respected versions in the virtual env

virtualenv --system-site-packages-foldername # this creates virtual env with all the modules and versions that are preinstalled on base python interpretor 

deactivate # to come out of the virtual env

1
mypthon\Scripts\activate
0

New to Communities?

Join the community