Executing .py files from the shell#

Learning Objectives#

After working through this topic, you should be able to:

  • Activate a conda environment in your shell

  • Execute python files from your shell

Materials#

We assume that you have already watched the screencasts on installation and have a fully working conda installation on your computer.

We also assume that you have watched the screencasts on the shell and know how to navigate to directories in a shell.

Video:

Download the slides.

Note

VS Code uses a different mechanism to activate environments. So in case you are using a terminal integrated in VS Code, conda activate epp will have no effect. Instead:

  1. Open a Python file in the project

  2. Press Ctrl+Shift+P to open the command palette, type “Python: Select Interpreter”, and select the epp environment

  3. Make sure the correct interpreter is selected (see screenshot below)

  4. Open a new shell

Quiz#