Command Line Python Scripting
We looked at the command line Python interpreter in the last lesson. The interpreter lets us run Python commands and see their results immediately. It’s very useful for quickly testing snippets of code, as well as debugging. But it’s not a good way to develop Python programs, because the commands aren’t saved anywhere.
In order to develop Python programs, we’ll need to make files containing Python code. Then we’ll be able to use the interpreter to run them from the command line. This way, we can save all of our commands and still see what’s happening.
This is a very common way to develop with Python — use an IDE or text editor to create Python files, then run them from the command line.
We can make a file that Python can execute on the command line by adding some lines of Python code to a blank text file.
In this lesson, you will learn how to create and run Python scripts using the command line. You will also learn about virtual environments and how they can be used to keep a set of packages isolated from another environment to prevent conflicts.
As you work through each concept, you’ll get to apply what you’ve learned from within your browser so that there’s no need to use your own machine to do the exercises. The command line environment inside of this course includes answer checking so you can ensure that you’ve fully mastered each concept before learning the next concept.
- The basics of command line Python.
- Learn to install new Python packages using pip.
- What virtual environments are and how to use them.
- Introduction to Command Line Python
- Using Different Python Versions
- Installing Packages that Extend Python
- Overview of Virtual Environments
- Creating a Python 3 virtualenv
- Activating a virtualenv
- Verifying the Installed Packages
- Importing Saved Functions into a File
- Accessing Command Line Arguments
- Deactivating a virtualenv