--- title: Installing Python tags: COMP1010-21T3 --- # Installing Python For the latter part of this course, we will be building more complex programs than can't be written in Python Notebooks. For this reason, you will need to have a Python interpreter and a source-code editor installed on your computer. Fortunately, both of these things are available for free and can be installed relatively easily. For this course, we recommend using the Python interpreter available from python.org and Visual Studio Code as a source-code editor. However, if you have gotten a Python interpreter from somewhere else, or a have different source-code editor you prefer, you can use them if you wish. We encourage you to do whatever you are comfortable with. ### Overview These instructions describe generally what needs to be done to install Python and Visual Studio Code. In most cases, we expect them to work as is, but it always possible that there is something particular about your computer that causes them not to work properly. If you have any problems you can post a comment below or talk to your tutor during your lab. #### Windows 1. Download <a href="https://python.org/">Python 3.9.7 from python.org </a>. If you hover over the 'Download' button in the menu, it should give you a button to download the right version of Python for your operating system. 2. Once the download has finished, double click the file to install Python. Follow the prompts to install the software, but make sure to: * Tick the box <strong>Add Python 3.9 to PATH </strong>at the start of installation * Click the button <strong>Disable path length limit </strong>after installation. 3. Download <a href="https://code.visualstudio.com/">Visual Studio Code </a>from its website. The main button on the page should download the right version for your computer. 4. Once downloaded, install it. Make sure the following boxes are ticked during installation. * <strong>Add "Open with Code" action to Windows Explorer file context menu</strong> * <strong>Add "Open with Code" action to Windows Explorer directory context menu</strong> * <strong>Register Code as an editor for supported file types</strong> * <strong>Add to PATH (requires shell restart)</strong> 5. Download a file containing all the course material so far from <a href="https://github.com/sim-mautner/cs1010-21t3/archive/refs/heads/main.zip">here</a>. It's a zip file containing a folder called <strong>cs1010-21t3-main </strong>. Copy or extract this folder to wherever you keep your coursework. 6. Right click on the folder itself and click "Open with Code". It's important to do it this way as Visual Studio Code needs to be aware of the entire contents of the folder. 7. Click on **resources-and-references** -&gt; <strong>python-setup</strong> and <strong>setup.ipynb </strong>on the left-hand section of the window. You will be asked to install the recommended extensions. Click <strong>Install </strong>and wait until a tab titled <strong>Python - Getting Started </strong>opens. This may take a little while. 8. Close all open tabs and go back to the Explorer view by clicking <strong>View </strong>in the top menu then <strong>Explorer </strong>. Click on <strong>setup.ipynb again </strong>and click <strong>Trust all notebooks </strong>. Tick the box below Jupyter: <strong>Always Trust Notebooks </strong>.<strong></strong><strong></strong> 9. Close all open tabs and click on <strong>setup.ipynb </strong>again <strong></strong>. This opens it as a trusted notebook. Follow the instructions in the notebook itself to finish the installation. #### Mac 1. Download <a href="https://python.org/">Python 3.9.7 from python.org </a>. If you hover over the 'Download' button in the menu, it should give you a button to download the right version of Python for your operating system. 2. Double click on the file and follow the prompts to install it. After installing, double click on **Update Shell Profile.command** and **Install Certificates.command** to configure it for use. 3. Download <a href="https://code.visualstudio.com/">Visual Studio Code</a> and copy it to the **Applications** folder. 4. Download a file containing all the course material so far from <a href="https://github.com/sim-mautner/cs1010-21t3/archive/refs/heads/main.zip">here</a>. It's a zip file containing a folder called <strong>cs1010-21t3-main </strong>. Copy or extract this folder to wherever you keep your coursework. 5. Open the Visual Studio Code application and use <strong>File -&gt; Open </strong>to open the <strong>cs1010-21t3-main </strong>folder. 6. Click on **resources-and-references** -&gt; <strong>python-setup</strong> and <strong>setup.ipynb </strong>on the left-hand section of the window. You will be asked to install the recommended extensions. Click <strong>Install </strong>and wait until a tab titled <strong>Python - Getting Started </strong>opens. This may take a little while. 7. You may be prompted to install the Xcode command line tools. If so, install them. You may find them useful later on in the course. 8. Close all open tabs and go back to the Explorer view by clicking <strong>View </strong>in the top menu then <strong>Explorer </strong>. Click on <strong>setup.ipynb again </strong>and click <strong>Trust all notebooks </strong>. Tick the box below Jupyter: <strong>Always Trust Notebooks </strong>.<strong></strong><strong></strong> 9. Close all open tabs and click on <strong>setup.ipynb </strong>again <strong></strong>. This opens it as a trusted notebook. 10. You may be asked to install Jupyter. If so, click Install and wait for it to finish installing. If asked to select the python version, <strong>make sure to pick Python 3.9.7 </strong>. Follow the instructions in the notebook itself to finish the installation.