Mastering Python for Networking and Security
上QQ阅读APP看书,第一时间看更新

Installing Python on Windows

Windows users can obtain the installer from the main Python site: https://www.python.org/ftp/python/2.7.15/python-2.7.15.msi. Just double-click the installer, and follow the steps to install it. It should create a directory at C:/Python27/; this directory will have the Python.exe interpreter as well as all of the default libraries installed.

The Python installation allows you to customize where the environment will be installed. The default location for Python 2.7.14 is C:\Python27, although you can specify another location. This route will be relevant when looking for certain modules and tools.

We can customize the installation if we want to include the documentation or install a series of utilities, such as the pip package manager or the IDLE development environment, to edit and execute scripts. It is recommended you leave the options marked so that it installs them and we have as complete an environment as possible:

It is important to check the Add python.exe to the Path box. This will allow you to run Python directly from the command prompt from any path without having to go to the installation directory.

At the time of installing the version of Python for Windows, you can also see that it is available IDLE, an editor or IDE (Integrated Development Environment) of Python that will allow us to write and test the code. Once installed, we can verify that everything is correct:

  1. Open the folder where you have installed it
  2. Enter C:\Python27\Lib\idlelib
  3. Run the idle.bat file with a double-click
Another option we have for Windows users is WinPython, which is available at  http://winpython.github.io.

WinPython is a Python distribution; you can install it on Windows 7/8/10 operating systems for scientific and educational use.

This distribution is something different from others because it:

  • Requires no installation: WinPython lives entirely in its own directory, without any OS installation
  • Is portable: You can easily zip your python project and install in other machines in an easy way