Python Guide
This is meant to be a quick guide to help people install python onto their machines.
I will note that this guide was written to be used by either Windows or Mac users. If you are on Linux, you can use the following to help you install python. (Although, I fear it may be a tad out of date)
https://docs.python-guide.org/starting/install3/linux/
If you are using something other than Windows, Linux or Mac … god speed!
Finding your installer online
This website should take you through the process of finding and downloading the python installer for your operating system.
There is a 95% chance that your operating system is 64 bits, but just in case you want to check, for windows you can go to your settings page and check the system > about
section to find out concretely.
(Note, if you accidentally download the 32 bit version, when you have the 64 bit version, it is fine but it will impact performance.)
The instillation process
After you download Python, you should find an installer program somewhere on your computer.
The name and version will vary based upon which version of Python you choose to download and what architecture you are using, but that is irrelevant.
Double click the installer to run it, it should open up a window which looks like the following.
Make sure to select the option to add python.exe to PATH. If you do not do this the first time you run through, there are many ways to fix this listed below.
software-onboarding/Python-Tutorial at Python-Setup-Tutorial · waterloo-rocketry/software-onboarding
https://www.educative.io/answers/how-to-add-python-to-the-path-variable-in-mac
After that, you can happily click “Install Now” to install it onto your machine
Ensuring that it worked
Python needs to work on your command line. To test this, open a terminal
For Windows, you can do this by opening the built in windows command line
Search
cmd
in the search barIt should probably pop up, and you can either hit enter or simply click it
For Mac and Linux, you should use your terminal
Once you open it, it should look vaguely like this
Type the command python --version
and hit enter
to ensure that Python is installed on your machine
After this, type the command pip --version
to ensure that pip is installed on your machine
Congratulations! you have successfully installed python
Virtual Environments
Many projects make use of libraries. There are packaged programs which can be used by others for various purposes. For instance, many people make use of the library NumPy to perform complex mathematical operations.
As a result, every project has its own list of dependencies that the user is responsible for installing. However, this can become onerous to track and accurately document. It is also very difficult to separate out the dependencies that are truly required for a project from the full set of everything installed on your system.
Virtual Environments exist to solve this problem. They create a local environment where you can install dependencies as needed during development. Afterwards, one may simply check the list of dependencies installed locally to determine the requirements of the project.
To install the virtual environment library, execute the following command in your command line
Creating a Virtual Environment
Navigate to the directory where you want to store all of the files needed by your virtual environment using the
cd [Directory name]
command
execute the
python -m venv [Directory]
where[Directory]
should be replaced with what you want to call the folder. In most cases, people simply call itvenv
Notice, that after you execute this command, you will find a new folder in the directory you executed the command in
Activating a Virtual Environment
Activate the virtual environment
For osx/linux:
source [Directory]/bin/activate
For windows:
[Directory]\Scripts\activate
The small brackets before the command prompt (venv)
serve as confirmation that it worked
Deactivating a Virtual Environment
Run the following command