This repository was archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall_packets.py
More file actions
47 lines (39 loc) · 1.36 KB
/
install_packets.py
File metadata and controls
47 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
input("This program should help you install lxml and requests modules, using many different methods. Press Enter to continue.")
def method1(package):
from pip._internal import main
main(['install', package])
import requests
import lxml
def method2(package):
import pip
pip.main(['install', package])
import requests
import lxml
def method3(package):
import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
import requests
import lxml
def method4(package):
import subprocess
subprocess.call(['pip', 'install', package])
import requests
import lxml
for package in ["requests", "lxml"]:
try:
method1(package)
except:
try:
method2(package)
except:
try:
method3(package)
except:
try:
method4(package)
except Exception as e:
print(e)
print("Sorry, but i couldn't help. search in google for more options (your goal is to install requests and lxml modules")
print("Here's a good place to start: https://www.google.com/search?q=Installing+python+module+within+code ")
input("Press any key to continue")