Install ubuntu in python virtual environment

Look all the way to direct command operation (Note: python3 under):

1, install the virtual environment:

  sudo pip3 install virtualenv

2, installed virtual environment management tool extensions:

  sudo pip3 install virtualenvwrapper

3, configuration management tools extend the virtual environment:

  Enter vim .bashrc

  Add configuration information at the bottom:

    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

    export WORKON_HOME = $HOME/.virtualenvs

    export /usr/local/bin/virtualwrapper.sh   

  PS: 

    This operation can also be handled by the GUI, open the Desktop folder, some files are generally hidden attribute, you can use the shortcut key (CTRL + H) made to the hidden files show up, then find 

    .bashrc file, right-opened for configuration information above is added, and finally i save.

  Finally, to activate the file by executing source ~ / .bashrc command, if the following message appears, indicating that the virtual environment has been created successfully extended tool:

  

 

   Then in the home directory will be called .vritualenvs folder, this folder and files are shown in the image corresponds to.

4, create a virtual environment:

  mkvirtualenv -p python3 django (such as creating a virtual environment Django)

  The same command can create multiple virtual environments, such as in the creation of a virtual environment called my_django

  mkvirtualenv -p python3 my_django

  Once created automatically enter the virtual environment created in the last (automatic activation):

  

 

   + View command creates several virtual environments:

    lsvirtualenv

    

 

   Django + switch to the virtual environment:

    workon django

    

 

   + Exit current virtual environment:

    deactivate

    

 

   + Delete virtual environment:

    rmvirtualenv my_django

    

 

     Look at the show:

    

 

     my_django virtual environments has been deleted. (Delete one environment, we can not delete the current working environment, you must quit before you can delete)

    

    Fall + current virtual environment:

     cdvirtualenv

     

 

       Pwd will then see the location of the virtual environment:

       

 

     + If they wish to enter sitepackage (sitepackages directory is installed python-related packages) directory:

      cdsitepackages

       

 

      On the operating system will be installed when the virtual environment prior to installation of python3 copied

      

 

 

 

   

 

 

    

  

  

  

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/jcjc/p/11512483.html