Python PIP

Check if PIP is Installed

python -m pip --version
pip --version

update pip

pip install --upgrade pip

upgrade package

pip install --upgrade  <package-name>

ตัวอย่างติดตั้ง package camelcase

pip install camelcase

การใช้ Package camelcase · PyPI

import camelcase

c = camelcase.CamelCase()
txt = "hello world"

print(c.hump(txt))           # Hello World
from camelcase import CamelCase
c = CamelCase()
s = 'this is a sentence that needs CamelCasing!'
print (c.hump(s))
# This is a Sentence That Needs CamelCasing!

*ดูจาก output เหมือนจะเป็น PascalCase ?

Find Packages

PyPI · The Python Package Index

Remove a Package

> pip uninstall camelcase

Listing Packages #

> pip list

To list outdated packages, and show the latest version available:

> pip list --outdated
Package    Version Latest Type
---------- ------- ------ -----
Jinja2     3.1.2   3.1.3  wheel
Markdown   3.5.1   3.5.2  wheel
setuptools 65.5.0  69.0.3 wheel

To show details about an installed package:

> python -m pip show Jinja2
Name: Jinja2
Version: 3.1.2
Summary: A very fast and expressive template engine.
Home-page: https://palletsprojects.com/p/jinja/
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD-3-Clause
Location: c:\project\github3\mkdocs\.venv\lib\site-packages
Requires: MarkupSafe
Required-by: mkdocs, mkdocs-material