To install, uninstall or list the installed packages in Python, you can use the pip command-line tool.
List installed Python packages
Run the following command to list all installed packages:
pip list
This command will display a list of installed packages along with their versions.
Example:
Notes:
If you are experimenting, we recommend you to create a virtual environment for installing or uninstalling packages. You have your guides here:
Install a Python package
Run the following command to install a specific Python package:
pip install <package_name>
Python packages are typically installed from the Python Package Index (PyPI), which is a repository of software packages for the Python programming language. When you use tools like pip to install packages, they are downloaded from PyPI and installed on your system.
Remove an installed Python package
Run the following command to remove a specific installed package:
pip uninstall <package_name>
Example:
(codetryout_demo) PS C:\> pip uninstall requests
Found existing installation: requests 2.31.0
Uninstalling requests-2.31.0:
Would remove:
c:\codetryout_demo\lib\site-packages\requests-2.31.0.dist-info\*
c:\codetryout_demo\lib\site-packages\requests\*
Proceed (Y/n)? y
Successfully uninstalled requests-2.31.0
(codetryout_demo) PS C:\>
Here is another guide to on How to create your own Python Package / module