-
Notifications
You must be signed in to change notification settings - Fork 0
Installing Python
This is a detailed guide on installing Python 3 on your computer. Additional instructions are also provided on how to install useful packages and tools to be used with Python.
-
First, you must install the Homebrew package manager. Open a terminal and run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -
Insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your
~/.profilefileexport PATH=/usr/local/bin:/usr/local/sbin:$PATH -
Finally, run the homebrew command to install python
brew install python
Note: The python installation will also use the pip python package manager. We will use this to install the python utilities
and libraries that we will need.
Most modern linux distributions come with python preinstalled.
-
You can check if you have Python 3 installed opening a terminla instance and running
python3 --version. If a version 3.x.x is returned, it means you have python3 installed. -
If you receive an error or a message saying python3 does not exists as a command, you can install it by running
sudo apt-get install python3
- Obtain the Windows python installer from the python downloads page
- Navigate to where the executable was downloaded and run the installer. The file should be named something similar to
python-3.x.x.exe - To make sure of the python package manager
pip, you will first need to ensure that python has been added to your computer's PATH variable. To do this, do the following:-
Open the Start Menu and search for 'My Computer' on Windows 7, or 'This PC' on Windows 8/10
-
Right click on the icon and select 'Properties'
-
In the window that pops up, select 'Advanced system settings'
-
In the new window, click the 'Environment Variables' button
-
Under the 'User variables' section, select the 'Path' variable, and click the 'Edit' button. In the pop up window, go to the end of the 'Variable value' field, and add the following path to the old value, separated by a semicolon (
;). If the 'Path' variable doesn't exists, then click the 'New' button and create it with the same pathC:\Users\[YOUR USERNAME]\AppData\Local\Programs\Python\[YOUR PYTHON VERSION]\ScriptsNOTE: ensure the values in
[...]in the path is substituted by the appropriate values on your system
-
Virtualenv a tool to create isolated Python environments (virtual environments). This package allows us to manage dependencies in a sandbox on a per-project basis, thereby not polluting the system-level installation. Also, virtualenv allows us to conveniently report the dependency chain, selectively remove dependencies, and even delete all dependencies by simply deleting the virtualenv directory. To install virtualenv:
-
Open a
terminalinstance on Mac/Linux, or runcmd.exeon Windows -
Upgrage pip and install virtualenv
pip install --upgrade pip pip install virtualenv