0% found this document useful (0 votes)
48 views1 page

Python

This document provides two methods for installing modules in Python using pip. The first method uses the os module to run the pip install command directly from Python. The second method uses the subprocess module to run pip install as a separate process and capture the output. Both methods install the beautifulsoup4 module as an example.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Python

This document provides two methods for installing modules in Python using pip. The first method uses the os module to run the pip install command directly from Python. The second method uses the subprocess module to run pip install as a separate process and capture the output. Both methods install the beautifulsoup4 module as an example.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//how to install modules in python

import os

os.system("pip install beautifulsoup4")

or

import subprocess

exe = subprocess.Popen("pip install beautifulsoup4")

exe_out = exe.communicate()

print(exe_out)

You might also like