Friday, 19 May 2017

Python Setup

1. Download Python :

2. Execute python-2.7.12.msi

                              Python installs to a directory with the version number embedded, e.g. Python version 2.7 will install at C:\Python27\so that you can have multiple versions of Python on the same system without conflicts. Of course, only one interpreter can be the default application for Python file types.

It also does not automatically modify the PATH environment variable, so that you always have control over which copy of Python is run.

3. Typing the full path name for a Python interpreter each time quickly gets tedious, 
  so add the directories for your default Python version to the PATH. 
  Assuming that your Python installation is in C:\Python27\, add this to your PATH:


The second (Scripts) directory receives command files when certain packages are installed, so it is a very useful addition.

Install the tools and libraries described in the next section before you start building Python
 applications for real-world use. In particular, you should always install Setuptools, 
 as it makes it much easier for you to use other third-party Python libraries.

4. Setuptools + Pip

  The most crucial third-party Python software of all is Setuptools, 
which extends the packaging and installation facilities provided by the distutils in the 
standard library. Once you add Setuptools to your Python system you can download and 
install any compliant Python software product with a single command. It also enables you 
to add this network installation capability to your own Python software with very little work.

To obtain the latest version of Setuptools for Windows, run the Python script available here:

The script will download the appropriate distribution file and install it for you.
Once installation is complete, you will find an '" easy_install " program in your Python Scripts sub-directory.

You’ll now have a new command available to you: easy_install. It is considered by 
many to be deprecated, so we will install its replacement: pip.

Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install.

# python

    For installing pip

Download get-pip script from the location



 Verify a successful installation by type pip freeze. pip freeze displays the version 
number of all modules installed in your Python non-standard library.

C:\Python27>pip freeze Or pip list

freeze : Output installed packages in requirements format.
list   : List installed packages.

So there are two differences:

Output format, freeze gives us the standard requirement format that may be used later 
with pip install -r to install requirements from.

Output content, pip list include editable which pip freeze does not

Pip is using for install / uninstall / download new packages

 pip --help

Python 2.7.9 (default, Mar  1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
ctrl+D --- in linux  and
ctrl+Z --- in windows

C:> python --version

No comments:

Post a Comment