Python
Install Python, manage packages, fix import errors. 20 commands.
- Install Python and start a projectInstall Python 3, then create a virtual environment so each project keeps its own packages.
- Install packages from requirements.txtInstall a Python project's packages in one go, and save your own list for others.
- Fix Python "ModuleNotFoundError: No module named"The package is missing, or installed for a different Python. Install it with the same Python that runs your code.
- Create and activate a Python virtual environmentGive each Python project its own private set of packages, so one project never breaks another.
- Create and switch conda environmentsInstall Miniconda, then give each project its own conda environment with its own Python version and packages.
- Fix "python: command not found"On macOS and Linux the command is python3, not python. On Windows, Python may not be installed yet.
- Fix pip "externally-managed-environment"Newer Python on macOS and Linux stops pip installing into the system Python. Use a virtual environment, or pipx for tools.
- Install a Python .whl fileInstall a Python package from a downloaded wheel (.whl) file.
- Install a specific version of a package (pip or npm)Pin a package to an exact version, for example to match a tutorial or avoid a breaking change.
- Install and switch Python versions with pyenvKeep several Python versions on one computer and pick which one each project uses, without touching the Python your system needs.
- Install Jupyter and open a notebookInstall JupyterLab in your project's virtual environment, start it and open a notebook in your browser.
- Install pipGet pip, Python's package installer, when pip: command not found.
- Lint and format Python with RuffInstall Ruff in your project, find likely mistakes, fix the easy ones and format every file in one consistent style.
- List installed packages and their versions (pip or npm)See what's installed in your project or globally, and which version of a package you have.
- Run tests with pytestInstall pytest in your project's virtual environment, then run all your tests, one file or one test by name.
- Start a Python project with uvuv, the very fast Python tool that installs Python, creates the environment and manages packages in one go.
- Uninstall a package (pip or npm)Remove a package you no longer need, or clear out everything pip installed.
- Update PythonMove to a newer Python, without breaking the one your system relies on.
- Update Python packagesFind out-of-date packages in your project and update them.
- Upgrade pipUpdate pip itself when it warns you a new version is available.