First of all to install on the computer Python2 and Python3 (can refer to my article: http://www.cnblogs.com/tk2049jq/p/7043480.html)
- Install Python2 and 3 in turn virtualenv and Virtualenvwrapper-win (using PIP2 and PIP3 respectively, we recommend using the Watercress Image: Pip2 Install *-I https://pypi.douban.com /simple)
- Modify the mkvirtualenv under Python2 and 3\scripts: Change to Mkvirtualenv2 and Mkvirtualenv3 respectively (rmvirtualenv, Workon also change, When it's easy to create and use, remind yourself of what the environment is.
- Delete the virtual environment for Python (typically under the C:\Users\ user name) in the virtual environment, leaving the corresponding Python version (the Python version to remind yourself of the virtual environment)
- This installs successfully, you can use MKVIRTUALENV2/3 to create a different Python virtual environment, then use WORKON2/3 for environment switch, RMVIRTUALENV2/3 Delete environment, deactivate exit environment
- When installing the module, be careful to distinguish between using PIP2 and PIP3
Python2 and Python3 have been pre-installed under ubuntu16.04 So just configure the virtual environment: I recommend using Python's python-venv module to install different virtual environments
1. Installing python2/3-venv
Apt-get Install Python2/3-venv
2. Create a virtual environment, test the name of the folder where the virtual environment resides
~/documents# PYTHON2/3-M venv test
3. Activate the virtual Environment source activate (to enter the installation directory: /test/bin/)
4. Exit the virtual Environment deactivate
Create a virtual environment for Python2 and Python3 virtualenv