How to install packages in python using python program ?

                              How to install packages in python using python program (code)?


import subprocess
import sys

def install(package):
    subprocess.call([sys.executable, "-m", "pip", "install", package])
# Exampleif __name__ == '__main__':
    a=['tk','sys','shutil','csv','numpy','pandas','datetime','time','webbrowser','PIL','smtplib','email','subprocess','cv2','setup','idna','cx_Freeze']

    for i in range(len(a)):
        install(a[i])



    '''    install('tk')    install('sys')    install('shutil')    install('csv')    install('numpy')    install('pandas')    install('datetime')    install('time')    install('webbrowser')    install('PIL')    install('smtplib')    install('email')    #install('MIMEText')    #install('MIMEBase')    #install('encoders')    install('subprocess')    install('cv2')    install('setup')    install('idna')    install('cx_Freeze')
'''

Recommended for you :-

How to send Emails in CSV file and other types of files.

How to install any OS in Amazon Web Services (AWS) .

How to use Amazon Web Services (AWS) instance(OS) in Windows using putty ?
how to add volume in aws instance and how to launch ec2 instance in aws.connect4 game Using java

STUDENT ATTENDANCE SYSTEM USING FACE ID


Comments