Virtualenv is used to create a standalone Python environment where multiple python is independent from each other and is capable of: 1. Install the new Suite 2 without permission. Different apps can use a different suite version 3. Package upgrade does not affect other apps
Virtualenv creates an environment with its own installation directory, which does not share libraries with other virtual environments, makes it easy to manage Python versions and manage Python libraries. It mainly solves the problem of environment conflict between different projects.
Little Tricks
Some development packages will be downloaded in the case of download error, if you configure the domestic image download, then the chance of error will be greatly reduced. Using the image source is simple, specifying it with-I is OK:
sudo pip install-i https://pypi.douban.com/simple/saltTesting
For example, now you need to install the Django environment
Virtualenv use
If you need to uninstall Django you can usepip uninstall django
virtualenv Basic Use a standalone environment that requires a new virtualenv after installation to view its Help commands:
Basic commands
The commonly used parameters are:
-P: Specifies a version of the Python environment, which is typically used when multiple Python versions are installed on your system, and by default virtualenv takes precedence over its hosting Python environment. That is, it installs under that Python version and chooses which version will default to the default Python isolation environment.
--no-site-packages: A Python installation package that does not use the system environment, that is, an installation package in which the real Python environment cannot be used in the quarantine package; The current version is the default.
--system-site-packages: A Python installation package that, contrary to the above, enables the isolated environment to access the system environment
--distribute:copy a branch of a Python environment that installs basic modules such as Setup, Pip, wheel, etc. by default
Virtualenv test, use this command to create a python environment under the specified path, which is consistent with the system environment by default. If you want to enter the virtual environment to enter the test/scripts/folder, run Activate.bat, under Linux under the Bin directory, Run command for the source xx/xx/activate Exit command for Deactivate.bat
Specify a different Python environmentvirtualenv -p C:\Python27\python2.exe py2
Quick Configuration
VIRTUALENV-based virtual environment management tools
pip install virtualenvwrapper-win
After the installation is complete, configure the environment variables.
Workonhome
You can then use Workon to display the virtual environment, Mkvirtualenv xx to create a virtual environment, Workon XXX into the virtual environment
Other
When using PIP installation may be prompted to find some files, you can go here to find the WHL file, mainly for Windows user file, downloaded into the virtual environment using PIP installation can be used
MKVIRTUALENV Create other versions of the virtual environment,mkvirtualenv --python=C:\Python27\python2.exe py2scrapy
Linux requires configuration after installing Virtualenvwrapper, find virtualenvwrapper.sh First
Modifying a configuration file
Modify Content
Reload Configuration