FlashKeepers

Python · Python · College and University

Python Virtual Environments and Pip

Creating and managing virtual environments and installing dependencies with pip, each explained with a short example.

About this set

30 basic cards for Python Python. It opens with "What is a Python virtual environment?" and "Why should you use a virtual environment?". More College and University decks are listed below.

30 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a Python virtual environment?
Show answerAn isolated Python installation on your system that has its own set of installed packages and Python version, separate from the system Python.
Why should you use a virtual environment?
Show answerTo avoid package version conflicts between projects. Each project can have different versions of the same package without interfering with each other.
What is pip?
Show answerPython's package installer. It downloads and installs Python packages from the Python Package Index (PyPI).
How do you create a virtual environment named 'myenv' using venv?
Show answerpython -m venv myenv
How do you activate a virtual environment on macOS or Linux?
Show answersource myenv/bin/activate
How do you activate a virtual environment on Windows?
Show answermyenv\Scripts\activate
How do you deactivate a virtual environment?
Show answerdeactivate
What is the difference between venv and virtualenv?
Show answervenv is Python's built-in module (Python 3.3+), while virtualenv is a third-party package that works on older Python versions and has more features.
How do you install a package called 'requests' using pip?
Show answerpip install requests
How do you list all packages installed in your virtual environment?
Show answerpip list
How do you create a requirements.txt file from your current environment?
Show answerpip freeze > requirements.txt
How do you install all packages listed in a requirements.txt file?
Show answerpip install -r requirements.txt
How do you upgrade an installed package to the latest version?
Show answerpip install --upgrade package_name
How do you uninstall a package?
Show answerpip uninstall package_name
How do you check the version of an installed package?
Show answerpip show package_name

15 more cards in the app

Study this set free