![]() |
Installing Modules / packages - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Installing Modules / packages (/thread-32372.html) |
Installing Modules / packages - Oshadha - Feb-05-2021 Is there any script to make python install a pip module? Ex : try: import Module except: install Module RE: Installing Modules / packages - Jeff900 - Feb-05-2021 I have found this code earlier to do so (not my work though, but it worked for me) import subprocess import sys def install(package): subprocess.check_call( [sys.executable, "-m", "pip", "install", package]) install('pandas')So in your case your exception should include the code within the code in my install function. In this case 'pandas' is an example ofcourse. |