Created
September 22, 2025 14:12
-
-
Save fralau/c10472a64893ee4b996d030b2f97713e to your computer and use it in GitHub Desktop.
Python: install a package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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