In Python development, some specific packages must be installed in order to manage and debug the project. It is said that the industry is called Yak shaving-to do a very cool and gorgeous Python project before you have to do some boring preparatory work. This article describes the installation of Setuptool,pip, distribute, nose, and virtualenv.
1,python2.x Bug
First a bug in Python 2.x will cause the package to fail to install, in 2.7 as an example modified as follows:
C:\PYTHON27\LIB\MIMETYPES.PYC line249
2, after the above modification, the installation is simple.
Easyintaller
Easy_install is a great Python tool that allows you to install many Python programs easily.
Https://pypi.python.org/pypi/setuptools--Windows (Simplified) Download ez_setup.py to a path, cmd into the path under type command python ez_ setup.py the installation is complete
Pip
Pip is a tool for installing and managing Python packages and is a replacement for Easy_install, making it easy to install, update, and uninstall Python packages using PIP.
First step: Https://pypi.python.org/pypi/pip download, run Python setup.py install to complete the installation
Step Two: Set the Windows environment variable, add C:\Python27\Scripts to path, restart the cmd window
Step three: Pip is used, such as the most basic pip install ModelName
Other necessary modules
I. Code package build and release distribute
Distribute is the replacement of Setuptools (Setuptools is no longer maintained at the end of the package)
Install with PIP: Pip install Distribute
II. Test module nose
Nose is one of the most popular test libraries for Python, and the nose runtime automatically looks for files whose names begin with "Test_". As with the name of the test module, the name of the test function must also start with Test_. Typically, nose will only look for test files under the current working directory unless specified with the-w parameter. When looking for a file, it will search for folders, files, modules, and packages at the beginning of test. In particular, nose will scan the entire package recursively to look for test tests. If the test is found, the Setup appliance runs and then runs the test function or class.
After installation, there will be a Nosetests.exe file in C:\PythonXX\Scripts that can be run by typing ' nosetests ' on the command line (it will automatically find the directory and file containing the "test" string in the current directory for testing). So if you haven't added an environment variable before, remember to add C:\PythonXX\Scripts to the environment variable so that you can refer to Nosetests.exe directly in other directories.
Installing Nose:pip install nose with PIP
III. Python Environmental Management virtualenv
Virtualenv is used to create a standalone Python environment where multiple python is independent from each other. Environmental isolation refers to the ability to deploy multiple Python environments in parallel (side-by-side) on the same machine, each of which is independent of each other and has its own Python programs, libraries, and executable programs. In this way, you can provide multiple developers with a non-impacting development environment on a single machine, as well as a non-impacting execution environment for multiple applications on the same server. It can:
A) Install the new kit without permission
b) Different package versions can be used for different applications
c) package upgrade does not affect other applications
install with PIP: Pip install virtualenv
Windows XP Python2.7 Package management tool installs-setuptool,pip, distribute, nose, virtualenv