【发布时间】:2021-03-30 05:58:40
【问题描述】:
所以我正在使用 SonarCloud/SonarLint 并且必须设置一些预备程序 - 即创建 AzureDevOps 和 Pipeline。这是我第一次深入 Azure,老实说,我不明白如何解决这个错误。我假设我需要创建一个“requirements.txt”文件,或者我需要安装依赖项......或者两者兼而有之。无论哪种方式,老实说,我不知道从哪里开始。有人可以帮忙吗?下面是我从测试管道中得到的日志,这是我的问题所在。我的假设是对的吗?提前致谢!
2020-12-20T01:30:10.5970195Z ##[section]Starting: Install dependencies
2020-12-20T01:30:10.5977975Z ==============================================================================
2020-12-20T01:30:10.5978665Z Task : Command line
2020-12-20T01:30:10.5978936Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-12-20T01:30:10.5979213Z Version : 2.178.0
2020-12-20T01:30:10.5979420Z Author : Microsoft Corporation
2020-12-20T01:30:10.5979702Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-12-20T01:30:10.5980019Z ==============================================================================
2020-12-20T01:30:11.0224446Z Generating script.
2020-12-20T01:30:11.0226001Z ========================== Starting Command Output ===========================
2020-12-20T01:30:11.0229091Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/f501a929-0e67-45b9-9e28-7047fe9295cf.sh
2020-12-20T01:30:15.1478266Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:15.8292586Z Collecting pip
2020-12-20T01:30:15.8700890Z Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
2020-12-20T01:30:15.9513160Z Installing collected packages: pip
2020-12-20T01:30:15.9513725Z Attempting uninstall: pip
2020-12-20T01:30:15.9514085Z Found existing installation: pip 20.3.1
2020-12-20T01:30:16.0461039Z Uninstalling pip-20.3.1:
2020-12-20T01:30:16.0935089Z Successfully uninstalled pip-20.3.1
2020-12-20T01:30:16.9255324Z Successfully installed pip-20.3.3
2020-12-20T01:30:17.4315243Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:17.5185497Z ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
2020-12-20T01:30:17.5845613Z ##[error]Bash exited with code '1'.
2020-12-20T01:30:17.5859482Z ##[section]Finishing: Install dependencies
【问题讨论】:
-
是的,您需要创建一个
requirements.txt文件。这可能会对您有所帮助:stackoverflow.com/a/29938588/6952359 -
谢谢@HarshanaSerasinghe - 我应该在我的 IDE 中运行它,然后将它推送到 AzureDevOps 以便在管道中使用它吗?我目前正在使用 PyCharm
-
是的,您可以使用 IDE 来执行此操作。然后推送到 AzureDevOps
-
是时候将您的 Python 和代码升级到 Python 3。Python 2 的生命周期已经结束一年了。
-
嗨@nTerXplorSux。这张票有更新吗?如果 Sajeetharan 的回答可以解决这个问题,请随时告诉我。只是提醒this。
标签: python azure cloud azure-pipelines