Week 9: Expanding Python's Capabilities
Learn how to use modules and packages to extend Python's functionality.
Explore Chapter 9Packages and the `pip` Package Manager.
Packages are a way of organizing Python modules into directories and subdirectories. This helps to avoid naming conflicts and makes it easier to distribute and install collections of modules.
`pip` - The Python Package Installer
`pip` is the standard package manager for Python. It allows you to easily install, upgrade, and uninstall packages from the Python Package Index (PyPI), a vast repository of open-source Python software.
Basic `pip` Commands
You usually run `pip` commands in your terminal or command prompt.
- Installing a package: `pip install package_name` (e.g., `pip install requests`)
- Upgrading a package: `pip install --upgrade package_name`
- Uninstalling a package: `pip uninstall package_name`
- Listing installed packages: `pip list`
- Showing information about a package: `pip show package_name`
It's generally a good practice to use virtual environments (using tools like `venv` or `conda`) to isolate your project dependencies and avoid conflicts between different projects.