1 Star 1 Fork 8

Cody Gu/LQ-Challenge2-PyCV

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup.py 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
菠萝有点酸 提交于 2024-09-13 02:51 . update setup.py.
# 这个文件是用来快速初始化的
import argparse
import subprocess
import sys
# use python type hints to make code more readable
from typing import List, Optional
def pip_install(proxy: Optional[str], args: List[str]) -> None:
if proxy is None:
subprocess.run(
[sys.executable, "-m", "pip", "install", "-i", f"https://pypi.tuna.tsinghua.edu.cn/simple", *args],
check=True,
)
else:
subprocess.run(
[sys.executable, "-m", "pip", "install", f"--proxy={proxy}",*args],
check=True,
)
def main():
parser = argparse.ArgumentParser(description="install requirements")
parser.add_argument(
"--proxy",
default=None,
type=str,
help="specify http proxy, [http://127.0.0.1:1080]",
)
args = parser.parse_args()
# 如果后期有需要添加的包就写这个列表里
pkgs = f"""
numpy
opencv-python
opencv-contrib-python
imutils
pillow
pyserial
"""
for line in pkgs.split("\n"):
# handle multiple space in an empty line
line = line.strip()
if len(line) > 0:
# use pip's internal APIs in this way is deprecated. This will fail in a future version of pip.
# The most reliable approach, and the one that is fully supported, is to run pip in a subprocess.
# ref: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
# pip.main(['install', *line.split()])
pip_install(args.proxy, line.split())
print("\nsuccessfully installed requirements!")
if __name__ == "__main__":
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/codygua/lq-challenge2-py-cv.git
[email protected]:codygua/lq-challenge2-py-cv.git
codygua
lq-challenge2-py-cv
LQ-Challenge2-PyCV
master

搜索帮助