Quick syntax reference for importing modules and using pip.
Bring modules (code files) into your script.
Entire Module:
import module_name
# Use: module_name.object_name
With Alias:
import module_name as alias
# Use: alias.object_name
Specific Object(s):
from module_name import object_name
# Use: object_name
from module_name import object1, object2
# Use: object1, object2
All Objects (Use with caution):
from module_name import *
# Use: object_name (directly)
Install and manage third-party packages from PyPI. Use in your terminal/command prompt.
Install Package:
pip install package_name
Install Specific Version:
pip install package_name==1.2.3
Upgrade Package:
pip install --upgrade package_name
Uninstall Package:
pip uninstall package_name
List Installed Packages:
pip list
Create requirements.txt:
pip freeze > requirements.txt
Install from requirements.txt:
pip install -r requirements.txt