The first step to learn any programming language is actually not
Hello World, but the installation of the language package.
Python has two branches now, Python 2.x and Python 3.x. Python 2.x is legacy as its final version 2.7 release came out in 2010. Python 3 was introduced in 2008 and it has the latest version as 3.6.4 (as for January 2018). Python 3 is preferred to learn because it is rewritten to eliminate the design flaw of Python 2 to have a higher efficiency performance. If you are new to Python, you should start with the future-oriented Python 3.
Python 3 Installation
Python 3 on Windows
Firstly, go to Python official website download page https://www.python.org/downloads/ to download the latest version of Windows - Python 3.6.4 as it is in January 2018.
The installation directory of Python is by default embedded with the Python version number, e.g. The latest version Python 3.6.4 will be installed at
C:\Python36\. You could install multiple Python versions installed on your PC without any conflicts. But it also means that you need to specify the Python version number every time you start python if you have multiple Python versions. For example, put
C:\Python36\ to the system
PATH variables. Or for simplicity, you could use the bash script below to modify
Be aware of that
PATH=C:\Ptyon36 should be ahead of
%PATH%, otherwise, the system will call the Python in the existing system
PATH has already contained other Python version’s full path.
Python 2 on Windows
The installation process is similar to the above process with the difference that you should download latest Python 2 version, that is, Python 2.7.14 as it is in January 2018.
Virtual Environment Installation
A virtual environment is a Python environment in which you can install separate interpreter, libraries, and scripts. So this virtual environment is isolated from other virtual environments and any change (installation and deletion) will not affect this virtual environment.
Python virtual environment can be created by using the following tools:
venvwhich is present by default when you install Python version 3.3 and later and it installs
setuptoolsin virtual environment in Python version 3.4 and later.
virtualenvis also a tool to create Python virtual environment. Python version 2.6+ and 3.3+ are supported by
virtualenv. When you are using
virtualenvfor creating virtual environment,
wheelswill be installed by default in our virtual environment.
In this section,
virtualenv will be used to create an isolated Python virtual environment and then packages will be installed into the corresponding virtual environment:
Below are the steps you should follow,
pipdownload link: https://bootstrap.pypa.io/get-pip.py
Run command prompt as administrator and navigate to the folder where you have downloaded
Now run the following commands for the installation of
C:\> cd Users\HP\AppData\Local\Programs\Python\Python36-32 C:\Users\HP\AppData\Local\Programs\Python\Python36-32> Python distribute_setup.py C:\Users\HP\AppData\Local\Programs\Python\Python36-32> Python get-pip.py
pip install virtualenv