How to set up your computer for Python
Get Python
-
Install latest version of Python from the official website. We used version 3.8
-
We suggest to use Jupyter Notebook to edit and run Python code. You can install it via
pip
by runningpip3 install jupyter
in your terminal/PowerShell.
How to run case studies in Python
-
Install
Pipenv
We use Pipenv for Python dependency management. First, install it via
pip
by running the following code in your terminal/PowerShell:pip3 install pipenv
-
Create virtual environment and install required packages
Go to the
da_case_studies
folder to create a virtual environment and install packages by running the following code in your terminal/PowerShell:pipenv sync
This installs the required Python version and packages stored in the
Pipfile.lock
.
NOTE: For Windows users, the above code might result in an error, because the pipenv
terminal shortcut sometimes does not install properly. In this case, run python3 -m pipenv sync
.
NOTE: Python environment was testet thoroughly only on Mac OS. Windows users might experience bugs, therefore we prepared requirements.txt
for all package==version we used in the notebooks and requirements_pipenv.txt
for all packages and dependencies used in the virtual environment.
-
Run Jupyter Notebook
To start a Jupyter Notebook in this virtual environment, go to the
da_case_studies
folder and run the following code in your terminal/PowerShell:pipenv run jupyter notebook
The jupyter environment should be opened on your default browser. You are good to go!
NOTE: For Windows users, the above code might result in an error, because the pipenv
terminal shortcut sometimes does not install properly. In this case, run python3 -m pipenv run jupyter notebook
.