Created
October 23, 2017 23:19
-
-
Save pm-hwks/b092b6ebf389b9bae8e4248875fda0b1 to your computer and use it in GitHub Desktop.
[Install pip packages using code] use this script to install python packages using nothin but python code and also list installed packages #python #pip #packages #install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install requests package and list packages | |
import pip | |
# install request package using pip | |
pip.main(['install', 'requests']) | |
# List installed packges | |
installed_packages = pip.get_installed_distributions() | |
installed_packages_list = sorted(["%s==%s" % (i.key, i.version) | |
for i in installed_packages]) | |
print(installed_packages_list) | |
import requests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment