Python Tutorial - Installation
The first step to learn any programming language is actually not Hello World, but the installation of the language package.
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 PATH.
set PATH=C:\Python36;%PATH%
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 installspipandsetuptoolsin 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 byvirtualenv. When you are usingvirtualenvfor creating virtual environment,pip,setuptoolsandwheelswill 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,
-
Install
distributeandpip
distribute download address: https://pypi.python.org/pypi/distribute/
pip download link: https://bootstrap.pypa.io/get-pip.py
-
Run command prompt as administrator and navigate to the folder where you have downloaded
distributeandpip. -
Now run the following commands for the installation of
distributeandpip:
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
-
Install
virtualenv:
pip install virtualenv
Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.
LinkedIn Facebook