PIP上是否有任何特定选项可以隐藏安装日志?
实际上,我正在尝试制作一个小脚本!
在这里,我具有配置函数,因此根据功能使用
操作系统,它将安装所有要求,我想知道的是,是否有任何选择可以隐藏PIP安装日志的日志...
def configure():
finished_event = threading.Event()
progress_bar_thread = threading.Thread(target=run_progress_bar, args=(finished_event,))
progress_bar_thread.start()
logger.warn('Starting Configuration')
logger.info('Installing Dependencies')
os.system('pip3 install -r install.txt')
#os.system("bash system_setup.sh")
logger.info('Dependencies Installed')
finished_event.set()
progress_bar_thread.join()
return True
所以在我的输出日志中,我不想看到此要求 我只想看到我的功能的进度。
Progress: -2022-06-19 22:29:32.980663 [INFO] Installing Dependencies
Progres: /Requirement already satisfied: colorama in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 1)) (0.4.4)
Requirement already satisfied: flask in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 2)) (2.1.2)
Requirement already satisfied: selenium in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 3)) (4.2.0)
Requirement already satisfied: rotate-screen in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 4)) (0.1.0)
Requirement already satisfied: importlib-metadata>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (4.11.4)
Requirement already satisfied: click>=8.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (8.1.3)
Requirement already satisfied: Werkzeug>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: itsdangerous>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: Jinja2>=3.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (3.1.2)
Requirement already satisfied: trio-websocket~=0.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.9.2)
Requirement already satisfied: trio~=0.17 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.21.0)
Requirement already satisfied: urllib3[secure,socks]~=1.26 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (1.26.9)
Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->flask->-r install.txt (line 2)) (3.8.0)
Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Jinja2>=3.0->flask->-r install.txt (line 2)) (2.1.1)
Requirement already satisfied: outcome in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: async-generator>=1.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.10)
Requirement already satisfied: attrs>=19.2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (21.4.0)
Requirement already satisfied: sortedcontainers in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (2.4.0)
Requirement already satisfied: sniffio in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.2.0)
Requirement already satisfied: idna in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (3.3)
Requirement already satisfied: wsproto>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio-websocket~=0.9->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2022.5.18.1)
Requirement already satisfied: pyOpenSSL>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (22.0.0)
Requirement already satisfied: cryptography>=1.3.4 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (37.0.2)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.7.1)
Progrees: -Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.15.0)
Requirement already satisfied: h11<1,>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium->-r install.txt (line 3)) (0.13.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2.21)
Progress: /2022-06-19 22:29:34.338922 [INFO] Dependencies Installed
已经满足了,相反, 原木,让我知道,谢谢
Actually I am trying to make A small script!!
Here i have configure function, so according to the function using
os, it will install all the requirements, what i wanna know is, is there any option to
hide the logs of pip install logs...
def configure():
finished_event = threading.Event()
progress_bar_thread = threading.Thread(target=run_progress_bar, args=(finished_event,))
progress_bar_thread.start()
logger.warn('Starting Configuration')
logger.info('Installing Dependencies')
os.system('pip3 install -r install.txt')
#os.system("bash system_setup.sh")
logger.info('Dependencies Installed')
finished_event.set()
progress_bar_thread.join()
return True
So in my output log, i don't wanna see this requirement already satisfied, instead i wanna see only the progress of my function..
Progress: -2022-06-19 22:29:32.980663 [INFO] Installing Dependencies
Progres: /Requirement already satisfied: colorama in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 1)) (0.4.4)
Requirement already satisfied: flask in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 2)) (2.1.2)
Requirement already satisfied: selenium in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 3)) (4.2.0)
Requirement already satisfied: rotate-screen in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 4)) (0.1.0)
Requirement already satisfied: importlib-metadata>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (4.11.4)
Requirement already satisfied: click>=8.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (8.1.3)
Requirement already satisfied: Werkzeug>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: itsdangerous>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: Jinja2>=3.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (3.1.2)
Requirement already satisfied: trio-websocket~=0.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.9.2)
Requirement already satisfied: trio~=0.17 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.21.0)
Requirement already satisfied: urllib3[secure,socks]~=1.26 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (1.26.9)
Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->flask->-r install.txt (line 2)) (3.8.0)
Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Jinja2>=3.0->flask->-r install.txt (line 2)) (2.1.1)
Requirement already satisfied: outcome in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: async-generator>=1.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.10)
Requirement already satisfied: attrs>=19.2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (21.4.0)
Requirement already satisfied: sortedcontainers in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (2.4.0)
Requirement already satisfied: sniffio in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.2.0)
Requirement already satisfied: idna in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (3.3)
Requirement already satisfied: wsproto>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio-websocket~=0.9->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2022.5.18.1)
Requirement already satisfied: pyOpenSSL>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (22.0.0)
Requirement already satisfied: cryptography>=1.3.4 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (37.0.2)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.7.1)
Progrees: -Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.15.0)
Requirement already satisfied: h11<1,>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium->-r install.txt (line 3)) (0.13.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2.21)
Progress: /2022-06-19 22:29:34.338922 [INFO] Dependencies Installed
So if you anyways to hide pip install -r install.txt
Logs, let me know, Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,实际上我找到了一种内置的方法,
它的JUS
pip3 -q install -r install.txt
就是这样,Q代表安静的地方
参考: https://github.com/pypa/pipa/pip/issues/271
非常感谢
So actually i found an inbuilt method to do it,
its jus
pip3 -q install -r install.txt
Thats it, the q stands for quiet in the place
ref: https://github.com/pypa/pip/issues/271
Thanks a lot