Virtual environment related name command

  • # Installation 
    PIP install virtualenvwrapper-win -> Windows version 
    PIP install virtualenvwrapper     -> mac

     

  • # Using 
    1 to create a virtual environment and switches to this environment: mkvirtualenv name.
     2. By switching to a virtual environment: pip install requests -> installation module
     3 unloading module virtual environment:. Uninstall PIP Requests
     4. Check ambient All installed packages: pip list: all / pip freeze: no initial packages installed afterwards /   pip freeze- > all: all
     5. Activate the virtual environment: workon name
     6. See how many virtual environments: lsvirtualenv
     7. Delete the virtual environment: rmvirtualenv name
     8. Exit the virtual environment: deactivate

     

  • # On-line deployment: the completion of the project, with a lot of modules, frameworks, libraries rely on more than 300 --- -> need to ensure consistent production environment and development environment, 
    deployment -> is not running on the server, you need to Support for modules, frameworks, and dependencies
     # 1. Activate the virtual environment 
    workon name
     in the development environment # 2. Generate a dependency list in the virtual environment: requirements.txt, the command is not mandatory, but it is customary. 
    pip freeze> requirements.txt
     # 3. In a production environment or another development environment, batch installation depends on 
    pip instll- r requirements.txt
     # 4. Batch uninstall 
    pip uninstall -r requirements.txt -y --yes

     

Guess you like

Origin www.cnblogs.com/u-damowang1/p/12740331.html