mirror of
https://github.com/yuruotong1/autoMate.git
synced 2025-12-25 21:06:47 +08:00
update china mirror
This commit is contained in:
parent
d8d4a1fb5b
commit
f2d5858d0c
17
install.py
17
install.py
@ -1,9 +1,24 @@
|
||||
import subprocess
|
||||
import sys
|
||||
from util import download_weights
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
|
||||
def install_requirements():
|
||||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
|
||||
# Check if Google is accessible
|
||||
try:
|
||||
# Try to connect to Google with a timeout of 3 seconds
|
||||
urllib.request.urlopen('https://www.google.com', timeout=3)
|
||||
# If successful, install normally
|
||||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
|
||||
except (urllib.error.URLError, TimeoutError):
|
||||
print("Using Tsinghua mirror")
|
||||
subprocess.run([
|
||||
sys.executable, '-m', 'pip', 'install',
|
||||
'-r', 'requirements.txt',
|
||||
'-i', 'https://pypi.tuna.tsinghua.edu.cn/simple'
|
||||
])
|
||||
|
||||
|
||||
def adjust_python_env():
|
||||
# check if python is 3.12
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user