From ea16c858fca16e42224e7bab43f6404332d3124a Mon Sep 17 00:00:00 2001 From: cooper-mj Date: Sun, 28 Mar 2021 00:28:36 -0700 Subject: [PATCH 1/5] Remove virtualenvwrapper tutorial from MacOS setup instructions --- installing-python-macos.md | 255 ------------------------------------- 1 file changed, 255 deletions(-) diff --git a/installing-python-macos.md b/installing-python-macos.md index 767e2a4..861fc11 100644 --- a/installing-python-macos.md +++ b/installing-python-macos.md @@ -15,15 +15,6 @@ Throughout this document, we will: 3. Inside this environment, install useful packages. 4. (Optional) Modify the shell startup script to always activate our environment. -This approach works well and is straightforward to set up, but has its drawbacks. For those who feel more comfortable with the command line, we also provide instructions for a "better" solution involving a tool named `virtualenvwrapper`. Use of `virtualenvwrapper` is by no means necessary, but it can be nice to set up. To set up `virtualenvwrapper`, we will: - -1. Reset our environment to the default state. -2. Use Python 3.8.0's `pip` to install `virtualenvwrapper` globally. -3. Use `virtualenvwrapper` to create a managed virtual environment. -4. Inside this environment, install useful packages. -5. Modify the shell startup script to enable `virtualenvwrapper`'s tools by default. -6. (Optional) Modify the shell startup script to always activate our environment. - Let's get started! ## Install Python 3.8.0 @@ -276,252 +267,6 @@ This will cause the command `source ~/cs41-env/bin/activate` to be executed ever *Note: If you are using a different shell (`tcsh`, `zsh`, etc) than `bash`, you will need to place this startup command in your appropriate startup script, such as `~/.tcshrc` or `~/.zshrc`.* -## A "better" alternative: `virtualenvwrapper` - -Next, we'll install `virtualenvwrapper`. It is a third-party tool which is used to manage your Python virtual environments. For users who are not comfortable with the command line, I recommend stopping now with the successful installation of your virtual environment in the previous section. - -**Only follow the commands in this section if you are moderately comfortable with the command line.** - - -First, we will install the `virtualenvwrapper` package. You will need to grant root privileges to the installation script (thus the `sudo`), which will prompt you to enter a password. - -Note: `virtualenvwrapper` only works with `bash`, `ksh`, and `zsh`. Ensure that you are using one of those shells for these installation steps. - -``` -$ sudo -H python3 -m pip install virtualenvwrapper -Collecting virtualenvwrapper - Downloading virtualenvwrapper-4.7.1-py2.py3-none-any.whl -Collecting stevedore (from virtualenvwrapper) - Downloading stevedore-1.12.0-py2.py3-none-any.whl -Collecting virtualenv (from virtualenvwrapper) - Downloading virtualenv-15.0.1-py2.py3-none-any.whl (1.8MB) - 100% |████████████████████████████████| 1.8MB 381kB/s -Collecting virtualenv-clone (from virtualenvwrapper) - Downloading virtualenv-clone-0.2.6.tar.gz -Collecting pbr>=1.6 (from stevedore->virtualenvwrapper) - Downloading pbr-1.8.1-py2.py3-none-any.whl (89kB) - 100% |████████████████████████████████| 90kB 4.3MB/s -Collecting six>=1.9.0 (from stevedore->virtualenvwrapper) - Downloading six-1.10.0-py2.py3-none-any.whl -Building wheels for collected packages: virtualenv-clone - Running setup.py bdist_wheel for virtualenv-clone - Stored in directory: /Users//Library/Caches/pip/wheels/ -Successfully built virtualenv-clone -Installing collected packages: pbr, six, stevedore, virtualenv, virtualenv-clone, virtualenvwrapper -Successfully installed pbr-1.8.1 six-1.10.0 stevedore-1.12.0 virtualenv-15.0.1 virtualenv-clone-0.2.6 virtualenvwrapper-4.7.1 -``` - -Next, we'll need to do some one-time setup to configure the virtual environment for this class. - -``` -$ export WORKON_HOME="${HOME}/.virtualenvs" -$ export VIRTUALENVWRAPPER_PYTHON="$(which python3)" -``` - -This instructs the `virtualenvwrapper` utility to store all of your virtual environments in the folder `.virtualenvs/` in your home directory, and tells it that we'd like to use our version of Python 3.7 for our virtual environments. - -Next, we'll need to find the location of the `virtualenvwrapper.sh` script, which was downloaded by `pip` above. It should be at `/Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh`, but let's make sure. Run: - -``` -$ cat /Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh -``` - -*Note: If you installed Python 3.8.0 using `brew`, then `virtualenvwrapper.sh` is installed in a different location. It is likely installed at `"$(brew --prefix)"/bin/virtualenvwrapper.sh`, so try using this path instead of the above.* - -*If you've used a different package manager, see the below section on finding your `virtualenvwrapper.sh`.* - -Next, we're going to set up the virtual environment wrapper tools: - -``` -$ source /Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/premkproject -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/postmkproject -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/initialize -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/premkvirtualenv -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/postmkvirtualenv -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/prermvirtualenv -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/postrmvirtualenv -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/predeactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/postdeactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/preactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/postactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/get_env_details -``` - -*Remember to source the path to your `virtualenvwrapper.sh`, which may be different from the above if you installed Python from some package manager.* - -### Find `virtualenvwrapper.sh` - -Can't find your `virtualenvwrapper.sh`? This section will go over some tools to search your computer for it. - -On a Mac, the easiest way to do this is with `mdfind`, which emulates the behavior of Spotlight in the terminal: - -``` -$ mdfind virtualenvwrapper.sh -/Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh -/usr/local/bin/virtualenvwrapper.sh -$ -``` - -Copy the first result to your clipboard. If you see no results, or if you see an error like `mdfind: Command not found.`, you can also try the (slower but also effective) command: - -``` -$ find / -name virtualenvwrapper.sh -< ... lots and lots of output ... > -/Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh -/usr/local/bin/virtualenvwrapper.sh -$ -``` - -Copy the first result to your clipboard if you didn't have any luck with `mdfind`. - -If there are no results from the `find` command, go back and make sure that you have successfully installed `virtualenvwrapper` with `pip`. If further problems persist, contact a staff member. - -### Work on virtual environments - -In order to make sure everything went smoothly, run `workon` from the command prompt. This command prints a list of environments, currently empty. - -``` -$ workon -$ -``` -If you see a message like `workon: command not found`, then you have not successfully sourced the `virtualenvwrapper.sh` script in this terminal session. - -Now, we'll actually create the virtual environment for CS41. You can name your virtual environment anything you want, but we recommend a short, easy-to-remember name like `cs41-env`. When you run `mkvirtualenv`, a new environment is created, and we specify the particular version of Python to use via the `--python` option. - -``` -$ mkvirtualenv --python=`which python3` cs41-env -Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -Using base prefix '/Library/Frameworks/Python.framework/Versions/3.8' -New python executable in /Users/psarin/.virtualenvs/cs41-env/bin/python3 -Also creating executable in /Users/sredmond/.virtualenvs/cs41-env/bin/python -Installing setuptools, pip, wheel... -done. -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/cs41-env/bin/predeactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/cs41-env/bin/postdeactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/cs41-env/bin/preactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/cs41-env/bin/postactivate -virtualenvwrapper.user_scripts creating /Users/psarin/.virtualenvs/cs41-env/bin/get_env_details -``` - -Now, if you run `workon`, you should see the list of all environments, which now includes `cs41-env`. - -``` -$ workon -cs41-env -$ -``` - -You can type `workon cs41-env` to activate the environment, when it's not activated. - -``` -$ workon cs41-env -(cs41-env)$ -``` - -Let's make sure everything is running smoothly. Run all of the following commands and ensure that the output is appropriate. - -``` -(cs41-env)$ which python -/Users/psarin/.virtualenvs/cs41-env/bin/python -(cs41-env)$ python --version -Python 3.8.0 -(cs41-env)$ python -c "print('Hello world.')" -Hello world! -(cs41-env)$ which pip -/Users/psarin/.virtualenvs/cs41-env/bin/pip -(cs41-env)$ pip --version -pip 19.3.1 from /Users/psarin/.virtualenvs/cs41-env/lib/python3.8/site-packages/pip (python 3.8) -``` - -Lastly, install the useful Python packages discussed above into this virtual environment. Make sure that you are executing this `pip install` command from an active virtual environment. - -``` -(cs41-env)$ pip install "prompt-toolkit==2.0.10" "ipython[all]" jupyter jupyterlab numpy scipy matplotlib nltk scikit-learn requests flask pycodestyle autopep8 Pillow -``` - -### Startup Commands and Cleanup - -Every time you develop code for CS41, you will need to run `workon cs41-env` in order to activate your virtual environment. To deactivate it, you can run `deactivate`. - -Open your `~/.bash_profile` startup script for editing with the following command: - -``` -$ open -e ~/.bash_profile -``` - -Scroll to the bottom, and delete the line `source ~/cs41-env/bin/activate` if it exists. Save the file and return to the command line. - -Now, let's finish up by enabling `virtualenvwrapper` tools and (optionally) automating the activation our virtual environment. - -``` -$ deactivate -$ echo "export WORKON_HOME=${HOME}/.virtualenvs" >> ~/.bash_profile -$ echo "export VIRTUALENVWRAPPER_PYTHON=`which python3`" >> ~/.bash_profile -$ echo "source /Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh" >> ~/.bash_profile -``` - -It might be convenient to add `workon cs41-env` to your shell startup script. Optionally, run the following command, which will result in automatic activation of the CS41 virtual environment whenever you start a new shell session. - -``` -$ echo "workon cs41-env" >> ~/.bash_profile -``` - -To see that everything was appended correctly, run - -``` -$ tail ~/.bash_profile -< ... possibly some other stuff ... > -export WORKON_HOME=/Users/psarin/.virtualenvs -export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -source /Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh -workon cs41-env -``` - -The last line is optional. If you used a different path to `python3` or to `virtualenvwrapper.sh`, you will see corresponding output above. - -If you use a different shell startup script (for example, `~/.profile`), you will need to append the same line to the end of that startup script. - -### Cleaning Up - -If you've successfully made it through these `virtualenvwrapper` instructions, you are almost all ready to go. We will finish by removing up our old non-`virtualenvwrapper` installation (if you skipped to these instructions, that may not exist). - -Run the following command to delete our virtual environment at `~/cs41-env`. As always, when running an `rm` command, make sure that you are aware which files are going to be deleted. If you don't feel confident that you know what this command will do, you can delete the folder from a Finder window. - -``` -$ rm -rf "${HOME}/cs41-env" -``` - -Finally, you can deactivate your virtual environment by running - -``` -(cs41-env)$ deactivate -``` - -That's it! - -### Final Confirmation - -Open a new Terminal or iTerm window, and run the following to make sure that everything is correctly installed. - -``` -$ workon cs41-env -(cs41-env)$ python --version -Python 3.8.0 -(cs41-env)$ pip --version -pip 19.3.1 from /Users/psarin/.virtualenvs/cs41-env/lib/python3.8/site-packages/pip (python 3.8) -(cs41-env)$ ipython -Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) -Type 'copyright', 'credits' or 'license' for more information -IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help. - -In [1]: print("Hello world!") -Hello world! - -In [2]: quit() -(cs41-env)$ -``` - You did it! Celebrate with your friends. ## Credit From f285a83b5bb79f66ae431abc00a97f569e326b7f Mon Sep 17 00:00:00 2001 From: cooper-mj Date: Sun, 28 Mar 2021 00:31:43 -0700 Subject: [PATCH 2/5] MacOS 3.9.2 install updates, updated terminal I/O to mirror 2021 setup --- installing-python-macos.md | 132 +++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/installing-python-macos.md b/installing-python-macos.md index 861fc11..3745b43 100644 --- a/installing-python-macos.md +++ b/installing-python-macos.md @@ -10,66 +10,68 @@ In this course, you'll be writing lots of Python code, so it's important to get Throughout this document, we will: -1. Install Python 3.8.0 +1. Install Python 3.9.2 2. Create a virtual environment using this version of Python. 3. Inside this environment, install useful packages. 4. (Optional) Modify the shell startup script to always activate our environment. Let's get started! -## Install Python 3.8.0 +## Install Python 3.9.2 *Note: If you use `brew` or another package manager for Python installations, see the note at the bottom of this section instead.* -Navigate to the [Python 3.8.0 download page](https://www.python.org/downloads/release/python-380/) in a web browser. +Navigate to the [Python 3.9.2 download page](https://www.python.org/downloads/release/python-392/) in a web browser. Scroll to the bottom of the page to the section labelled "Files." -Install the Python distribution that corresponds to your version of macOS. If you are running OS X 10.9 (Mavericks) or later, download the ["macOS 64-bit installer."](https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg). If you are running OS X 10.6 (Snow Leopard), OS X 10.7 (Lion), or OS X 10.8 (Mountain Lion), you will need to download an older version of Python; Python 3.7.6 can be downloaded at [this link](https://www.python.org/downloads/release/python-376/) by clicking on the ["macOS 64-bit/32-bit installer"](https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.6.pkg). If you need, you can determine which macOS your computer is running with [these instructions from Apple](https://support.apple.com/en-us/HT201260). +Install the Python distribution that corresponds to your version of macOS. If you are running OS X 10.9 (Mavericks) or later on an Intel processor, download the ["macOS 64-bit Intel installer."](https://www.python.org/ftp/python/3.9.2/python-3.9.2-macosx10.9.pkg). If you are running OS X 10.9 (Mavericks) or later on Apple Silicon, download the experimental ["macOS 64-bit universal2 installer"](https://www.python.org/ftp/python/3.9.2/python-3.9.2-macos11.pkg). -After downloading, double-click the downloaded file, and follow the on-screen instructions. +If you are running OS X 10.6 (Snow Leopard), OS X 10.7 (Lion), or OS X 10.8 (Mountain Lion), you will need to download an older version of Python; Python 3.7.6 can be downloaded at [this link](https://www.python.org/downloads/release/python-376/) by clicking on the ["macOS 64-bit/32-bit installer"](https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.6.pkg). If you need, you can determine which macOS your computer is running with [these instructions from Apple](https://support.apple.com/en-us/HT201260). -Let's double check that Python 3.8.0 was installed correctly. +After downloading, double-click the downloaded file, and follow the on-screen instructions to install Python 3.9.2. + +Let's double check that Python 3.9.2 was installed correctly. For the remainder of this setup document, we assume that you have a basic familiarity with the command line. We understand that not everyone will feel comfortable with the command line, because it is usually covered starting in CS107. However, I highly recommend using Nick Troccoli's amazing [CS107 resources](https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/resources/) for this quarter if you feel less experienced, particular the section titled "Common Unix Commands." The main takeaway is the following: If you something of the following form in this guide (you'll see this quite a few times!): ``` -psarin$ command +coopermj$ command ``` Then copy and paste the command into your command line prompt. Two quick notes: -1. The text before the `$` can vary dramatically. It is not necessarily your username. In this case, we are assuming that the username is `psarin` and that is the text which is shown before the `$` at your command prompt. (The below image illustrates a terminal in which the username does not appear directly before the `$`). +1. The text before the `$` can vary. It is not necessarily your username. In this case, we are assuming that the username is `coopermj` and that is the text which is shown before the `$` at your command prompt. (On the terminal below, for example, the text before the prompt includes more than just the username, including the current directory). 2. Below is a quick example of how you may go about running the commands immediately following this list. This is designed to clear up any ambiguity related to running commands at the command line. ![](term_example.png) -Open up a command line prompt (likely using Terminal.app or iTerm.app), and run the following commands: +Open up a command line prompt (likely using Terminal), and run the following commands: ``` -psarin$ which python3 -/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -psarin$ python3 --version -Python 3.8.0 +coopermj$ which python3 +/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 +coopermj$ python3 --version +Python 3.9.2 ``` -If you see the output shown above, then Python 3.8.0 was installed correctly on your machine! +If you see the output shown above, then Python 3.9.2 was installed correctly on your machine! Let's celebrate by writing some code! Run the following from a command prompt. You should see the following output, which leaves you at an interactive prompt, at which you can write Python code. ``` -psarin$ python3 -Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) +coopermj$ python3 +Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print("Hello world!") Hello world! >>> quit() -psarin$ +coopermj$ ``` Try writing some Python (perhaps `print("Hello world!")`) in the interactive interpreter! When you're done, you can exit the interactive interpreter by entering `quit()` at the Python command prompt or by pressing CTRL+D. @@ -78,17 +80,17 @@ Try writing some Python (perhaps `print("Hello world!")`) in the interactive int [Homebrew](https://brew.sh/) is "the missing package manager for macOS." It's a great way to install, upgrade, and manage many different types of packages on macOS, including Python. If you are not using `brew`, there is no requirement that you start for CS41. However, if you are already using `brew`, you might as well install Python through brew. -Run `brew install python3`. This will fetch the latest version of Python (which might not be Python 3.8.0, but that's all we can do). +Run `brew install python3`. This will fetch the latest version of Python (which might not be Python 3.9.2, but that's all we can do). -Then, continue the process above, after the installation of Python 3.8.0. +Then, continue the process above, after the installation of Python 3.9.2. ### Troubleshooting #### `which python3` shows no output -The `which` command searches your computer for a program matching a name. If `which python3` shows no output, it means that your computer can't find any appropriate `python3`. Pause and flag down a member of the course staff to help debug, or ask on Piazza. Include as much detail as you can about the problem. +The `which` command searches your computer for a program matching a name. If `which python3` shows no output, it means that your computer can't find any appropriate `python3`. Pause and reach out to a member of the course staff to help you debug. Include as much detail as you can about the problem. -#### `python3 --version` does not show `Python 3.8.0` -In this case, the version of Python 3 your computer wants to run is not the Python 3.8.0 that we just downloaded. Pause and flag down a member of the course staff to help debug, or ask on Piazza. Include as much detail as you can about the problem. +#### `python3 --version` does not show `Python 3.9.2` +In this case, the version of Python 3 your computer wants to run is not the Python 3.9.2 that we just downloaded. Pause and reach out to a member of the course staff to help you debug. Include as much detail as you can about the problem. ## Create a virtual environment @@ -97,9 +99,9 @@ We've correctly installed Python, so next we will create a virtual environment. Specifically, we will create a folder named `cs41-env` in your computer's home folder. The configuration of our virtual environment will live entirely inside of this folder. ``` -psarin$ python3 --version -Python 3.8.0 -psarin$ python3 -m venv ~/cs41-env +coopermj$ python3 --version +Python 3.9.2 +coopermj$ python3 -m venv ~/cs41-env ``` If these two lines execute without error, you have successfully created a virtual environment named `cs41-env`. @@ -111,8 +113,8 @@ If these two lines execute without error, you have successfully created a virtua For a given terminal session, a virtual environment is either active or inactive at any moment in time. To activate our virtual environment, you will need to run ``` -psarin$ source ~/cs41-env/bin/activate -(cs41-env) psarin$ +coopermj$ source ~/cs41-env/bin/activate +(cs41-env) coopermj$ ``` *Note: If your shell is `tcsh` or `csh`, you will have to run `source ~/cs41-env/bin/activate.csh` instead. If your shell is `fish`, you will have to run `. ~/cs41-env/bin/activate.fish` instead.* @@ -124,8 +126,8 @@ Observe that our command prompt, which previously was `psarin$`, now is `(cs41-e Deactivating a virtual environment is easy. From an activated environment, simply run ``` -(cs41-env) psarin$ deactivate -psarin$ +(cs41-env) coopermj$ deactivate +coopermj$ ``` Don't worry if you deactivate from an inactive environment. Nothing bad will happen, although you might see a `-bash: deactivate: command not found` error message, which you can safely ignore. @@ -135,39 +137,39 @@ Don't worry if you deactivate from an inactive environment. Nothing bad will hap Let's reactivate our virtual environment to see what's different when a virtual environment is active. ``` -psarin$ source ~/cs41-env/bin/activate -(cs41-env) psarin$ which python3 -/Users/psarin/cs41-env/bin/python3 -(cs41-env) psarin$ which python -/Users/psarin/cs41-env/bin/python -(cs41-env) psarin$ which pip3 -/Users/psarin/cs41-env/bin/pip3 -(cs41-env) psarin$ which pip -/Users/psarin/cs41-env/bin/pip +coopermj$ source ~/cs41-env/bin/activate +(cs41-env) coopermj$ which python3 +/Users/coopermj/cs41-env/bin/python3 +(cs41-env) coopermj$ which python +/Users/coopermj/cs41-env/bin/python +(cs41-env) coopermj$ which pip3 +/Users/coopermj/cs41-env/bin/pip3 +(cs41-env) coopermj$ which pip +/Users/coopermj/cs41-env/bin/pip ``` -It looks like all of our python-related commands are now located inside of the virtual environment. That's a good thing! You can confirm this by seeing that `/Users/psarin/cs41-env/bin:` is the first entry of the string printed by running `echo $PATH`. +It looks like all of our python-related commands are now located inside of the virtual environment. That's a good thing! You can confirm this by seeing that `/Users/coopermj/cs41-env/bin:` is the first entry of the string printed by running `echo $PATH`. Moreover, observe that: ``` -(cs41-env) psarin$ python3 --version -Python 3.8.0 -(cs41-env) psarin$ python --version -Python 3.8.0 -(cs41-env) psarin$ pip3 --version -pip 19.3.1 from /Users/psarin/cs41-env/lib/python3.8/site-packages/pip (python 3.8) -(cs41-env) psarin$ pip --version -pip 19.3.1 from /Users/psarin/cs41-env/lib/python3.8/site-packages/pip (python 3.8) +(cs41-env) coopermj$ python3 --version +Python 3.9.2 +(cs41-env) coopermj$ python --version +Python 3.9.2 +(cs41-env) coopermj$ pip3 --version +pip 21.0.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9) +(cs41-env) coopermj$ pip --version +pip 21.0.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9) ``` -The big takeaway is that, inside our active virtual environment, the commands `python` and `pip` now refer to Python 3.8.0 and it's associated package manager. +The big takeaway is that, inside our active virtual environment, the commands `python` and `pip` now refer to Python 3.9.2 and it's associated package manager. For example, when the virtual environment is active, we can enter an interactive Python 3 prompt simply by running: ``` -psarin$ python -Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) +coopermj$ python +Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> @@ -180,37 +182,39 @@ Type "help", "copyright", "credits" or "license" for more information. Next, we'll install useful Python packages that will serve us over the duration of this course. Let's first make sure that we're have activated the virtual environment. ``` -psarin$ source ~/cs41-env/bin/activate +coopermj$ source ~/cs41-env/bin/activate ``` Now, we'll update `pip`, Python's builtin package manager, just to make sure it's on the latest version (it should be). ``` -(cs41-env) psarin$ pip install --upgrade pip -Requirement already up-to-date: pip in ./cs41-env/lib/python3.8/site-packages (19.3.1) +(cs41-env) coopermj$ pip install --upgrade pip +Requirement already up-to-date: pip in ./cs41-env/lib/python3.8/site-packages (21.0.1) ``` -After, we'll install the suite of Jupyter tools and some additional useful packages +After, we'll install the suite of Jupyter tools and some additional useful packages. + +*Really, really make sure that you have activated `cs41-env` before running this line!* ``` -# Really, really make sure that you have activated `cs41-env` before running this line! -(cs41-env) psarin$ pip install "prompt-toolkit==2.0.10" "ipython[all]" jupyter jupyterlab numpy scipy matplotlib nltk scikit-learn requests flask pycodestyle autopep8 Pillow +(cs41-env) coopermj$ pip install "prompt-toolkit==2.0.10" "ipython[all]" jupyter jupyterlab numpy scipy matplotlib nltk scikit-learn requests flask pycodestyle autopep8 Pillow ``` -This will produce a huge amount of output, as Python is downloading these third-party libraries and tools from the internet and storing them inside our virtual environment. These packages will be available when our virtual environment is activated, but will not necessarily be available if our virtual environment is disactivated. For this reason, it's important to always have an active virtual environment when working on code in this class. +This will produce a huge amount of output, as Python is downloading these third-party libraries and tools from the internet and storing them inside our virtual environment. These packages will be available when our virtual environment is active, but will not necessarily be available if our virtual environment is inactive. For this reason, it's important to always have an active virtual environment when working on code for this class. The last few lines of the output should look like the following. If your output is dramatically different from this or the installation failed with an error, pause and get a member of the course staff to help or post on Piazza. ``` -Installing collected packages: decorator, pickleshare, wcwidth, six, prompt-toolkit, backcall, appnope, pygments, ptyprocess, pexpect, ipython-genutils, traitlets, parso, jedi, pyzmq, tornado, python-dateutil, jupyter-core, jupyter-client, ipykernel, ipyparallel, qtconsole, jsonschema, nbformat, prometheus-client, pandocfilters, defusedxml, testpath, webencodings, bleach, MarkupSafe, Jinja2, mistune, entrypoints, nbconvert, terminado, Send2Trash, notebook, widgetsnbextension, ipywidgets, numpy, nose, idna, urllib3, chardet, certifi, requests, imagesize, pyparsing, packaging, pytz, babel, docutils, alabaster, sphinxcontrib-websupport, snowballstemmer, Sphinx, ipython, jupyter-console, jupyter, scipy, cycler, kiwisolver, matplotlib, singledispatch, nltk, scikit-learn, pycodestyle, autopep8, Pillow - Running setup.py install for nltk ... done - Running setup.py install for autopep8 ... done -Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 Pillow-5.4.1 Send2Trash-1.5.0 Sphinx-1.8.3 alabaster-0.7.12 appnope-0.1.0 autopep8-1.4.3 babel-2.6.0 backcall-0.1.0 bleach-3.1.0 certifi-2018.11.29 chardet-3.0.4 cycler-0.10.0 decorator-4.3.0 defusedxml-0.5.0 docutils-0.14 entrypoints-0.3 idna-2.8 imagesize-1.1.0 ipykernel-5.1.0 ipyparallel-6.2.3 ipython-7.2.0 ipython-genutils-0.2.0 ipywidgets-7.4.2 jedi-0.13.2 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.2.4 jupyter-console-6.0.0 jupyter-core-4.4.0 kiwisolver-1.0.1 matplotlib-3.0.2 mistune-0.8.4 nbconvert-5.4.0 nbformat-4.4.0 nltk-3.4 nose-1.3.7 notebook-5.7.4 numpy-1.15.4 packaging-18.0 pandocfilters-1.4.2 parso-0.3.1 pexpect-4.6.0 pickleshare-0.7.5 prometheus-client-0.5.0 prompt-toolkit-2.0.7 ptyprocess-0.6.0 pycodestyle-2.4.0 pygments-2.3.1 pyparsing-2.3.0 python-dateutil-2.7.5 pytz-2018.9 pyzmq-17.1.2 qtconsole-4.4.3 requests-2.21.0 scikit-learn-0.20.2 scipy-1.2.0 singledispatch-3.4.0.3 six-1.12.0 snowballstemmer-1.2.1 sphinxcontrib-websupport-1.1.0 terminado-0.8.1 testpath-0.4.2 tornado-5.1.1 traitlets-4.3.2 urllib3-1.24.1 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.4.2 +Installing collected packages: wcwidth, prompt-toolkit, appnope, ptyprocess, pexpect, parso, jedi, pickleshare, pygments, ipython-genutils, traitlets, decorator, backcall, pytz, babel, sphinxcontrib-serializinghtml, snowballstemmer, urllib3, idna, certifi, chardet, requests, packaging, docutils, sphinxcontrib-jsmath, sphinxcontrib-devhelp, sphinxcontrib-qthelp, imagesize, sphinxcontrib-applehelp, MarkupSafe, jinja2, alabaster, sphinxcontrib-htmlhelp, Sphinx, entrypoints, pandocfilters, jupyterlab-pygments, testpath, mistune, webencodings, bleach, jupyter-core, attrs, pyrsistent, jsonschema, nbformat, defusedxml, pyzmq, tornado, jupyter-client, nest-asyncio, async-generator, nbclient, nbconvert, nose, pycparser, cffi, argon2-cffi, Send2Trash, terminado, ipykernel, prometheus-client, notebook, widgetsnbextension, jupyterlab-widgets, ipywidgets, qtpy, qtconsole, ipyparallel, ipython, jupyter-console, jupyter, sniffio, anyio, jupyter-server, nbclassic, jupyter-packaging, json5, jupyterlab-server, jupyterlab, scipy, click, joblib, regex, tqdm, nltk, threadpoolctl, scikit-learn, Werkzeug, itsdangerous, flask, toml, autopep8 + Running setup.py install for pandocfilters ... done + Running setup.py install for pyrsistent ... done + Running setup.py install for nltk ... done +Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 Sphinx-3.5.3 Werkzeug-1.0.1 alabaster-0.7.12 anyio-2.2.0 appnope-0.1.2 argon2-cffi-20.1.0 async-generator-1.10 attrs-20.3.0 autopep8-1.5.6 babel-2.9.0 backcall-0.2.0 bleach-3.3.0 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 click-7.1.2 decorator-4.4.2 defusedxml-0.7.1 docutils-0.16 entrypoints-0.3 flask-1.1.2 idna-2.10 imagesize-1.2.0 ipykernel-5.5.0 ipyparallel-6.3.0 ipython-7.22.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 itsdangerous-1.1.0 jedi-0.18.0 jinja2-2.11.3 joblib-1.0.1 json5-0.9.5 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-6.1.12 jupyter-console-6.4.0 jupyter-core-4.7.1 jupyter-packaging-0.7.12 jupyter-server-1.5.1 jupyterlab-3.0.12 jupyterlab-pygments-0.1.2 jupyterlab-server-2.3.0 jupyterlab-widgets-1.0.0 mistune-0.8.4 nbclassic-0.2.6 nbclient-0.5.3 nbconvert-6.0.7 nbformat-5.1.2 nest-asyncio-1.5.1 nltk-3.5 nose-1.3.7 notebook-6.3.0 packaging-20.9 pandocfilters-1.4.3 parso-0.8.1 pexpect-4.8.0 pickleshare-0.7.5 prometheus-client-0.9.0 prompt-toolkit-2.0.10 ptyprocess-0.7.0 pycparser-2.20 pygments-2.8.1 pyrsistent-0.17.3 pytz-2021.1 pyzmq-22.0.3 qtconsole-5.0.3 qtpy-1.9.0 regex-2021.3.17 requests-2.25.1 scikit-learn-0.24.1 scipy-1.6.2 sniffio-1.2.0 snowballstemmer-2.1.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 terminado-0.9.3 testpath-0.4.4 threadpoolctl-2.1.0 toml-0.10.2 tornado-6.1 tqdm-4.59.0 traitlets-5.0.5 urllib3-1.26.4 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1 ``` We will learn more about each of these packages throughout this course. -Most relevantly, you should now have access to `ipython`, an interactive Python interpreter that is vastly superior to the default Python interpreter. You can read an overview [here](http://ipython.readthedocs.org/en/stable/overview.html) if you'd like. To make sure `ipython` is configured correctly, run it from a command prompt, and ensure that you get something similar to the below. +Importantly, you should now have access to `ipython`, an interactive Python interpreter that is (in our humble opinion) vastly superior to the default Python interpreter. You can read an overview [here](http://ipython.readthedocs.org/en/stable/overview.html) if you'd like. To make sure `ipython` is configured correctly, run it from a command prompt, and ensure that you get something similar to the below. ``` (cs41-env)$ ipython @@ -241,7 +245,7 @@ And that's it! You are all done setting up your Python development environment f ## Summary -First, we installed Python 3.8.0 from the Python website and checked that everything was installed correctly. Next, we used `python3` to create a virtual environment named `cs41-env`, and we learned how to activate and deactivate this virtual environment. Lastly, we activated the environment and installed lots of useful packages. +First, we installed Python 3.9.2 from the Python website and checked that everything was installed correctly. Next, we used `python3` to create a virtual environment named `cs41-env`, and we learned how to activate and deactivate this virtual environment. Lastly, we activated the environment and installed lots of useful packages. **Reminder: Each time you create a new terminal session, you will need to run `source ~/cs41-env/bin/activate`.** @@ -253,7 +257,7 @@ In this course, we always assume that you are operating in an active virtual env ### Optional: Automatically enable `cs41-env` -If you want to automatically enable the `cs41-env` virtual environment every time you start a new interactive session, you can add a command to your shell's startup script. In most cases, this will be `~/.bash_profile` or `~/.bashrc`, which are different but in ways we don't care about. Run: +If you want to automatically enable the `cs41-env` virtual environment every time you start a new interactive session, you can add a command to your shell's startup script. In most cases, this will be `~/.bash_profile` or `~/.bashrc`, which are different but in ways that are not important to us right now. Run: ``` psarin$ echo "# Activate virtual environment for CS41." >> ~/.bash_profile From f577fa6a82404fdfdd948bf131fb8ef51faa777d Mon Sep 17 00:00:00 2001 From: cooper-mj Date: Sun, 28 Mar 2021 00:33:43 -0700 Subject: [PATCH 3/5] Minor tweaks - remove CS 41 link and command line consistency --- installing-python-macos.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/installing-python-macos.md b/installing-python-macos.md index 3745b43..34495b7 100644 --- a/installing-python-macos.md +++ b/installing-python-macos.md @@ -2,7 +2,7 @@ Hello! -This document provides a walkthrough to set up a Python development environment for [CS41](https://stanfordpython.com) on macOS. Alternate versions of this guide exist for [Linux](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-linux.md) and [Windows](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-windows.md) development. +This document provides a walkthrough to set up a Python development environment for CS 41 on macOS. Alternate versions of this guide exist for [Linux](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-linux.md) and [Windows](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-windows.md) development. ## Overview @@ -119,7 +119,7 @@ coopermj$ source ~/cs41-env/bin/activate *Note: If your shell is `tcsh` or `csh`, you will have to run `source ~/cs41-env/bin/activate.csh` instead. If your shell is `fish`, you will have to run `. ~/cs41-env/bin/activate.fish` instead.* -Observe that our command prompt, which previously was `psarin$`, now is `(cs41-env) psarin$`. This is one method by which you can see whether a virtual environment is activated. +Observe that our command prompt, which previously was `coopermj$`, now is `(cs41-env) coopermj$`. This is one method by which you can see whether a virtual environment is activated. ### Deactivating a virtual environment @@ -218,9 +218,9 @@ Importantly, you should now have access to `ipython`, an interactive Python inte ``` (cs41-env)$ ipython -Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) +Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10) Type 'copyright', 'credits' or 'license' for more information -IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help. +IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: ``` @@ -260,9 +260,9 @@ In this course, we always assume that you are operating in an active virtual env If you want to automatically enable the `cs41-env` virtual environment every time you start a new interactive session, you can add a command to your shell's startup script. In most cases, this will be `~/.bash_profile` or `~/.bashrc`, which are different but in ways that are not important to us right now. Run: ``` -psarin$ echo "# Activate virtual environment for CS41." >> ~/.bash_profile -psarin$ echo "source ~/cs41-env/bin/activate" >> ~/.bash_profile -psarin$ tail -n 2 ~/.bash_profile +coopermj$ echo "# Activate virtual environment for CS41." >> ~/.bash_profile +coopermj$ echo "source ~/cs41-env/bin/activate" >> ~/.bash_profile +coopermj$ tail -n 2 ~/.bash_profile # Activate virtual environment for CS41. source ~/cs41-env/bin/activate ``` From e286be67b7840d6ab2ef7042d7597d7eefd9d7fc Mon Sep 17 00:00:00 2001 From: cooper-mj Date: Mon, 29 Mar 2021 01:24:40 -0700 Subject: [PATCH 4/5] Update linux install instructions --- installing-python-linux.md | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/installing-python-linux.md b/installing-python-linux.md index 5aa13f4..f9650bf 100644 --- a/installing-python-linux.md +++ b/installing-python-linux.md @@ -10,25 +10,17 @@ In this course, you'll be writing lots of Python code, so it's important to get Throughout this document, we will: -1. Install Python 3.8.0 +1. Install Python 3.9.2 2. Create a virtual environment using this version of Python. 3. Inside this environment, install useful packages. -This approach works well and is straightforward to set up, but has its drawbacks. For those who feel more comfortable with the command line, we also provide instructions for a better solution involving a tool named `virtualenvwrapper`. In this portion, we will - -1. Reset our environment to the default state. -2. Use Python 3.8.0's `pip` to install `virtualenvwrapper` -3. Use `virtualenvwrapper` to create a managed virtual environment. -4. Inside this environment, install useful packages. -5. Modify the shell startup script to activate this virtual environment. - Let's get started! ## Prerequisite We assume that you have a basic familiarity with the command line. We understand that not everyone will feel comfortable with the command line, because it is covered starting in CS107. However, I highly recommend using Nick Troccoli's amazing [CS107 resources](https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/resources/) for this quarter if you feel less experienced, particular the section titled "Common Unix Commands." -## Install Python 3.8.0 +## Install Python 3.9.2 On different Linux systems, there are a couple of different ways to install and manage packages. We'll cover `apt-get` here, as well as how you can install from source. @@ -39,11 +31,11 @@ On different Linux systems, there are a couple of different ways to install and ``` $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update -$ sudo apt-get install python3.8 -$ sudo apt-get install python3.8-venv +$ sudo apt-get install python3.9 +$ sudo apt-get install python3.9-venv ``` -On Debian, we'll just have to `sudo apt-get install python3` and hope for the best. Also note that this might install a different version of Python 3.8, but we won't worry about that here. +On Debian, we'll just have to `sudo apt-get install python3` and hope for the best. Also note that this might install a different version of Python 3.9, but we won't worry about that here. ### Installing with `yum` (RedHat, CentOS) @@ -51,13 +43,13 @@ Other Linux distributions use a different package manager, `yum`. We don't have ### Other Linux package managers -The world of Linux distributions is unfathomably large. If you can pull off a Python 3.8 install on your distribution of choice, more power to you. However, we recommend building from source. +The world of Linux distributions is unfathomably large. If you can pull off a Python 3.9 install on your distribution of choice, more power to you. However, we recommend building from source. ### Installing from source Installing Python from source follows the same pattern as most other source installations. -First, download the source tarball (either [gzipped](https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz) or [XZ compressed](https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz)). Unzip the files and `cd` into the unzipped directory. +First, download the source tarball (either [gzipped](https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz) or [XZ compressed](https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tar.xz)). Unzip the files and `cd` into the unzipped directory. To build Python, just execute the usual commands: @@ -76,11 +68,5 @@ More information on the actual installation process can be found in the tarball' From here, the instructions are almost exactly the same as the [macOS](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-macos.md) instructions. Follow those instructions, with the following differences. -### Finding `virtualenvwrapper.sh` - -If you choose to use `virtualenvwrapper`, it will be installed in a platform-specific location. You will need to find this file. You can use the `find` command described in the linked document to search your computer for the downloaded file. - -If other unexpected differences come up between those instructions and your operating system, please let us know on Piazza so that we can update these instructions with distribution-specific dependencies. - ## Credit Much of this handout was based on a similar handout written by Sam Redmond (@samredmond) From 5ffe9efb77ed443f814eeebbf4eeba277aa06911 Mon Sep 17 00:00:00 2001 From: cooper-mj Date: Mon, 29 Mar 2021 02:10:42 -0700 Subject: [PATCH 5/5] Update Windows install instructions --- installing-python-windows.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/installing-python-windows.md b/installing-python-windows.md index 47fdb9b..2e4fcf2 100644 --- a/installing-python-windows.md +++ b/installing-python-windows.md @@ -30,15 +30,15 @@ Once you're in the `bash` shell, you can follow the [Linux](https://github.com/s ``` $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update -$ sudo apt-get install python3.8 -$ sudo apt-get install python3.8-venv +$ sudo apt-get install python3.9 +$ sudo apt-get install python3.9-venv ``` You can check which version of Python you've installed by running: ``` $ python3 --version -Python 3.8.0 +Python 3.9.2 ``` In broad strokes, you will need to run the following commands to set up a virtual environment. The Linux and macOS handouts contain more detailed information. @@ -60,7 +60,7 @@ Working with Windows is complicated enough, so we're going to omit the instructi Recall that we discourage this option as it is very complex and hard for us to debug. Only use this option if the above fails and you don't want to use a VM (Strategy 3) for some reason. -You will need Windows Vista or newer to use Python 3.8.0 on Windows. +You will need Windows 8.1 or newer to use Python 3.9.2 on Windows. When in doubt, the source of truth for Windows commands is [included in the Python documentation](https://docs.python.org/3/using/windows.html), and you can find more details on using virtual environments [here](https://docs.python.org/3/library/venv.html#module-venv). @@ -70,13 +70,13 @@ The rough outline is: 2. Create a virtual environment. 3. Use `pip` to install useful packages. -First, download the web-based installer from the [Python 3.8.0 releases page](https://www.python.org/downloads/release/python-380/), either for [x86-64](https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64-webinstall.exe) or [x86](https://www.python.org/ftp/python/3.8.0/python-3.8.0-webinstall.exe). The web-based installer is a small download which will connect to the internet to download any additional required components, so make sure that you are connected to the internet for the remainder of these installation instructions. +First, download the web-based installer from the [Python 3.9.2 releases page](https://www.python.org/downloads/release/python-392/), either for [x86-64](https://www.python.org/ftp/python/3.9.2/python-3.9.2-amd64-webinstall.exe) or [x86](https://www.python.org/ftp/python/3.9.2/python-3.9.2-webinstall.exe). The web-based installer is a small download which will connect to the internet to download any additional required components, so make sure that you are connected to the internet for the remainder of these installation instructions. -Start the installer. You will see two options: "Install launcher for all users (recommended)" and "Add Python 3.8 to PATH". Make sure both are selected, and then click "Install Now." +Start the installer. You will see two options: "Install launcher for all users (recommended)" and "Add Python 3.9 to PATH". Make sure both are selected, and then click "Install Now." *Note: Technically, you should also [remove the MAX_PATH limitation](https://docs.python.org/3/using/windows.html#removing-the-max-path-limitation), but we'll skip that for now.* -Follow the on-screen instructions to finish installing Python. When you are given the option of unchecking any 'optional' components, do not uncheck any. In particular, if there is an option called "Add python.exe to search path" on the "Customize Python 3.8" screen, make sure that box is checked! You should also see that `pip` is being installed by default. +Follow the on-screen instructions to finish installing Python. When you are given the option of unchecking any 'optional' components, do not uncheck any. In particular, if there is an option called "Add python.exe to search path" on the "Customize Python 3.9" screen, make sure that box is checked! You should also see that `pip` is being installed by default. Let's check to see that everything was installed correctly. @@ -89,13 +89,13 @@ Open up PowerShell or `cmd.exe` and run the following from a command prompt: You should see something like the following: ``` -Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) +Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> ``` -Ensure that the Python version above looks like 3.7.2. +Ensure that the Python version above looks like 3.9.2. If that doesn't work, try running: @@ -103,7 +103,7 @@ If that doesn't work, try running: > python ``` -If this drops you into a Python 3.8.0 interactive interpreter, great! In this case, everywhere you see `python3` below, replace it with the command `python`. +If this drops you into a Python 3.9.2 interactive interpreter, great! In this case, everywhere you see `python3` below, replace it with the command `python`. If this didn't work, try running: @@ -116,16 +116,16 @@ If this worked, then everywhere you see `python3` below, replace it with the com Try writing some Python in the interactive interpreter! When you're done, you can exit the interactive interpreter with `CTRL+C` or by entering `quit()` at the Python command prompt. ### Checking `pip` -First, let's check that we have `pip` installed. For CS41, we'll be using a package manager called `pip` to install and manage Python software packages. By default, Python 3.8.0 ships with a version of `pip` prebuilt. `pip` interacts very well with PyPI (the Python Package Index), so we'll be using `pip` extensively this quarter. +First, let's check that we have `pip` installed. For CS41, we'll be using a package manager called `pip` to install and manage Python software packages. By default, Python 3.9.2 ships with a version of `pip` prebuilt. `pip` interacts very well with PyPI (the Python Package Index), so we'll be using `pip` extensively this quarter. At a command prompt, run the following code. You should see something like the following output: ``` > python3 -m pip --version -pip 19.3 from /pip 19.3 from C:\Users\Parth\AppData\Local\Programs\Python\Python38\lib\site-packages (python 3.8) +pip 21.0.1 from /pip 21.0.1 from C:\Users\Parth\AppData\Local\Programs\Python\Python38\lib\site-packages (python 3.9) ``` -Problems might arise if you had a different version of Python 3 already installed, but if you added Python 3.8 to your PATH, this should work. +Problems might arise if you had a different version of Python 3 already installed, but if you added Python 3.9 to your PATH, this should work. ### Create a Virtual Environment