This comes preinstalled with Python 3.4 or higher. Similar to the Microsoft PowerShell Gallery, Python.org maintains an index of approved and community packages that can be imported and installed using ‘Import-Module activedirectory’ – I mean ‘pip install <package_name>’.
# Check if PIP is installed
pip --version
# List Installed packages
pip list
# Find packages
pip search <package_name>
# Display information about a package
pip show --verbose <package_name>
# Install packages
pip install <something>
# Uninstall packages & leave the source code on server
pip uninstall <package_name>
# Remove packages from server
pip remove <package_name>
Best practice: freeze package versions for coding consistency and deployment predictability. This is working against the default behavior, where pip would install the latest version of named packages
# Setup requirements
pip install -r requirements.txt
# Set specific versions of modules for pip to include
camelcase==0.2.1
django==1.4.2
Instead of manually inputting the package versions, it’s often more convenient to capture working configurations and write it into the requirements.txt as a baseline.
pip freeze -r pipFreeze_$(date +"%Y%m%d%H%M").txt > requirements.txt
Categories: