mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 20:14:36 +00:00
42 lines
824 B
Python
42 lines
824 B
Python
from pip._internal import main as pipmain
|
|
|
|
|
|
def install(package):
|
|
pipmain(['install', package])
|
|
|
|
|
|
def install_upgrade(package):
|
|
pipmain(
|
|
[
|
|
'install',
|
|
'--upgrade',
|
|
package,
|
|
'-i',
|
|
'https://pypi.tuna.tsinghua.edu.cn/simple',
|
|
'--trusted-host',
|
|
'pypi.tuna.tsinghua.edu.cn',
|
|
]
|
|
)
|
|
|
|
|
|
def run_pip(params: list):
|
|
pipmain(params)
|
|
|
|
|
|
def install_requirements(file, extra_params: list | None = None):
|
|
if extra_params is None:
|
|
extra_params = []
|
|
|
|
pipmain(
|
|
[
|
|
'install',
|
|
'-r',
|
|
file,
|
|
'-i',
|
|
'https://pypi.tuna.tsinghua.edu.cn/simple',
|
|
'--trusted-host',
|
|
'pypi.tuna.tsinghua.edu.cn',
|
|
]
|
|
+ extra_params
|
|
)
|