Introduction π
PIP stands for Package Installer for Python. It is the default tool used to install, upgrade, and manage Python packages from the Python Package Index (PyPI).
Note
1. Checking if PIP is Installed π§±
check_pip.sh
pip --versionβ Shows pip version and Python path.
2. Installing a Package Using PIP π¦
pip_install.sh
pip install requestsβ Installs the popular HTTP library requests.
3. Installing a Specific Version π―
install_version.sh
pip install django==4.0β Useful when your project needs specific versions.
4. Upgrading a Package β¬οΈ
update_package.sh
pip install --upgrade requests5. Uninstalling a Package β
uninstall.sh
pip uninstall requests6. Listing Installed Packages π
pip_list.sh
pip list7. Searching Packages on PyPI π
pip_search.sh
pip search flaskNote
8. Exporting Dependencies (requirements.txt) π
pip_freeze.sh
pip freeze > requirements.txtβ Records exact package versions for easy sharing.
9. Installing Packages from requirements.txt π₯
requirements_install.sh
pip install -r requirements.txt10. Installing a Package in a Virtual Environment π
First activate your environment, then install:
inside_venv.sh
source env/bin/activate # Mac / Linux
env\Scripts\activate # Windows
pip install numpy11. Installing from a GitHub Repository π§βπ»
install_github.sh
pip install git+https://github.com/user/repo.git12. Checking Package Information π§Ύ
show_info.sh
pip show requestsβ Shows version, author, location, dependencies, etc.
13. Upgrading PIP Itself π§
upgrade_pip.sh
pip install --upgrade pip14. Installing Wheel Files (.whl) π‘
install_wheel.sh
pip install package_name.whl15. Installing from a Local Folder π
install_local.sh
pip install ./mypackage/16. Real-World Usage Example π
real_world.sh
mkdir myproject
cd myproject
python -m venv env
source env/bin/activate
pip install flask
pip freeze > requirements.txtβ Now your Flask project is ready with all dependencies recorded.
17. Common Issues & Fixes β οΈ
πΉ **"pip: command not found"** β Install Python again, check PATH.
πΉ **Permission errors** β Use virtual environments.
πΉ **Package conflicts** β Use pip install --upgrade or manage with virtualenv.
Conclusion π
You now fully understand PIP in Python! Want the next topic? Try File Handling, Import System, OOP (Classes & Objects), or Packages Publishing. Just tell me! π