Python Forum

Full Version: run "install pip" when I get ModuleNotFoundError?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
wanted to know if there is a smart way to download when library is not exists?

for example :

try:
    import pandas as pd
except ModuleNotFoudError :
    print('No such libray - will download it no')
    # pip install pandas 
I recommend reading this official documentation first Using pip from your program.
Thank you