Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
vms:python:dev [2017/04/14 01:50]
admin [Virtualenvwrapper]
vms:python:dev [2017/05/31 02:54]
admin [Virtualenvwrapper]
Line 62: Line 62:
  
 Virtual Environments are used to isolate python versions and package dependencies for each specific project. Virtual Environments are used to isolate python versions and package dependencies for each specific project.
 +
 +We'll begin by creating specific users for python:
 +<​Code:​bash>​
 +> adduser py2
 +...
 +<​password>​
 +...
 +> adduser py3
 +...
 +<​password>​
 +...
 +
 +# To act as py2:
 +> su py2 
 +</​Code>​
  
 We'll install ''​virtualenv''​ for User only in order to allow coexistence of Python2 and Python3. As the virtualenv binary will bear the same name for 2 & 3, we'll move them on the go: We'll install ''​virtualenv''​ for User only in order to allow coexistence of Python2 and Python3. As the virtualenv binary will bear the same name for 2 & 3, we'll move them on the go:
Line 72: Line 87:
 > nano ~/.bashrc > nano ~/.bashrc
 ADD: ADD:
-Python ​virtualenv +USER INSTALLED BINARIES [virtualenv(wrapper)] 
-alias virtualenv2="~/.local/​lib/​python2.7/bin/virtualenv"​+export PATH=$PATH:~/​.local/​bin/​
  
 > source ~/.bashrc > source ~/.bashrc
-virtualenv2 ​--version+virtualenv ​--version
 15.1.0 15.1.0
 </​Code> ​ </​Code> ​
Line 127: Line 142:
 ADD: ADD:
  
-VirtualenvWrapper +USER INSTALLED BINARIES [virtualenv(wrapper)] 
-export WORKON_HOME=$HOME/projects/​.virtualenvs +export PATH=~/​.local/​bin:​$PATH 
-export PROJECT_HOME=$HOME/​projects/​code + 
-export VIRTUALENVWRAPPER_PYTHON=/​usr/​bin/​python3 +# VIRTUALENVWRAPPER 
-export ​PATH=~/.local/​lib/​python3.4/bin:$PATH +export WORKON_HOME=$HOME/​.virtualenvs 
-source $HOME/​.local/​lib/​python3.4/​bin/​virtualenvwrapper.sh+export PROJECT_HOME=$HOME 
 +export VIRTUALENVWRAPPER_PYTHON=/​usr/​bin/​python[2|3] 
 +export ​VIRTUALENVWRAPPER_VIRTUALENV=$HOME/.local/bin/​virtualenv 
 + 
 +source $HOME/​.local/​bin/​virtualenvwrapper.sh
  
 > source .bashrc > source .bashrc