I am new to Python. I am trying to write a program where I have to check and install any missing modules at the time of execution of the code. I am using the below code provided in the solution here.
# Code to check and install missing modules
import pip
# Define function to install missing modules
def install(package):
pip.main(['install', package])
# Call funtion and install missing module
if __name__ == '__main__':
install('win32com.client')
When I try executing this, I get the below message. Even when I tried replacing install('win32com.client')
by install('win32com')
, I still get a similar message. The code works if I used it to check and install pandas
module.
Collecting win32com.client
[31m Could not find a version that satisfies the requirement win32com.client (from versions: )[0m
[31mNo matching distribution found for win32com.client[0m
What am I doing wrong? How do I install the win32com.client
module using the code I have provided above? This needs to be checked and installed at the time of execution and should have no manual intervention. I am using Python 3.6.4 and my OS is Windows x64 bit. Any guidance on this would be appreciated.