使用同一VENV在PY文件中运行零工命令
我想在烧瓶网络服务(部署模式)中运行废纸,但是当使用OS.System时,它不会以与我运行WebService的同一Virtualenv运行scrapy。当我在本地主机上运行它时,我没有同样的问题。
子过程包具有相同的问题,我无法访问VENV路径。
有什么办法吗?
os.chdir(SCRAPYFILE_PATH)
os.system(f"scrapy crawl spider_name -o file.json")
I want to run scrapy in a flask webservice (deployment mode) but when using os.system it doesn't run scrapy in the same virtualenv that I run the webservice. I don't have the same problem when I run it on local host.
subprocess package has the same issue and I don't have access to venv path.
Is there any way to do it?
os.chdir(SCRAPYFILE_PATH)
os.system(f"scrapy crawl spider_name -o file.json")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它使用OS和SYS工作:
It worked using os and sys: