Installing virtual environments and environment configurations in Python programming in Ubuntu
Ext.: http://www.cnblogs.com/Maker-Liu/p/5524672.html
1. Upgrade Python package management tool PIP
Pip Install--upgrade pip Note: ' Pip install--upgrade package name ' When you want to upgrade a package
2.python Virtual Environment Installation
sudo apt-get install Python-virtualenvsudo easy_install virtualenvwrapper
The mkvirtualenv command is not found when the above tool is installed, and the following environment variable settings are required.
1. Create a directory to hold the virtual environment mkdir $HOME/.VIRTUALENVS2. Add rows in ~/.BASHRC: Export workon_home= $HOME/.virtualenvs Source/usr/local/bin /virtualenvwrapper.sh3. Run: source ~/.bashrc3. Creating a Python virtual environment
mkvirtualenv [Virtual Environment name]workon [virtual environment name]
4. Exit the virtual environment leave Deactivate5. Remove (Use caution) rmvirtualenv [Virtual Environment name]python version 2 development
Create a Python2 virtual development environment
Mkvirtualenv-p/usr/bin/python2.7 Xwp_py2
(Because on Ubuntu I installed python2.7 under the/usr/bin/Xwp_py2 is the name of my own virtual environment)
Using the python2.7+django1.7.8 environment, you should install the following environments:
(XWP_PY2) [Email protected]:~/workspace/itcast_project$ pip freeze list //Enter a virtual environment, this command is to see the configuration of the installation of the environment, if there is no such environment, then look down to the PIP ==8.1.0django==1.7.8ipdb==0.8.1ipython==3.2.0pillow==2.8.2
Save the above package name to Package_py2.txt, in your Python virtual environment, run://Package_py2.txt A random file that you use to execute the following command
Pip Install-r package_py2.txt
Python version 3 development
Our courses are based on Python2.7 because many third-party libraries are not over-Python3 series.
Create a Python3 virtual development environment
Mkvirtualenv-p/usr/bin/python3.4 Xwp_py3
Using the python3.4+django1.9.4 environment, you should install the following environments:
(XWP_PY3) [Email protected]:~/workspace/itcast_project$ pip Freeze listpip==8.1.0django==1.9.4ipdb==0.8.1ipython== 4.1.2pillow==2.8.2
Store the above package name in Package_py3.txt, and run it in your Python virtual environment:
Pip Install-r package_py3.txt
Pip Command Quick Check
- To view installed packages
Pip Show--files Somepackage
- Check which packages need to be updated
Pip List--outdated
- Upgrade Package
Pip Install--upgrade somepackage
- Uninstalling packages
Pip Uninstall Somepackage
- Parameter interpretation
Pip--help
Installing virtual environments and environment configurations in Python programming in Ubuntu