Skip to content

Instantly share code, notes, and snippets.

@fralau
Created September 22, 2025 14:12
Show Gist options
  • Select an option

  • Save fralau/c10472a64893ee4b996d030b2f97713e to your computer and use it in GitHub Desktop.

Select an option

Save fralau/c10472a64893ee4b996d030b2f97713e to your computer and use it in GitHub Desktop.
Python: install a package
def install_package(package:str):
"""
Install a package from pip
"""
try:
subprocess.check_call(["pip3", "install", package])
except subprocess.CalledProcessError:
raise NameError("Could not install package '%s'" % package)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment