由于没有“setup.py”,pip 安装失败也不是“pyproject.toml”成立

发布于 2025-01-17 23:14:02 字数 768 浏览 0 评论 0原文

我有一个SH脚本行(作为Jenkinsfile Groovy脚本的一部分)

    sh "python3 -m venv venv"
    sh "source venv/bin/activate"
    withCredentials([usernamePassword(credentialsId: XXXXXXX,
                                          usernameVariable: 'XXXXXXX',
                                          passwordVariable: 'XXXXXXX')]) {
    sh "pip install --extra-index-url 'https://${XXXXXXX}:${XXXXXX}@atifactory-url-base/artifactory/api/pypi/pypi-release-local/simple' -e ."
    }
    
    sh "pip freeze >> requirements.txt"

,但是,上面的

ERROR: file:///home/jenkins/workspace/XXXXXXXXXXX does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

项目失败了,我没有设置。使用-e安装Python项目?

I have a sh script line (as part of a Jenkinsfile groovy script) which does

    sh "python3 -m venv venv"
    sh "source venv/bin/activate"
    withCredentials([usernamePassword(credentialsId: XXXXXXX,
                                          usernameVariable: 'XXXXXXX',
                                          passwordVariable: 'XXXXXXX')]) {
    sh "pip install --extra-index-url 'https://${XXXXXXX}:${XXXXXX}@atifactory-url-base/artifactory/api/pypi/pypi-release-local/simple' -e ."
    }
    
    sh "pip freeze >> requirements.txt"

However, above fails with

ERROR: file:///home/jenkins/workspace/XXXXXXXXXXX does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

The project I have has no setup.py or requirements.txt file at the top level - how can I do this without adding the current python project for installation using -e?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

污味仙女 2025-01-24 23:14:02

如果您在 Dockerfile 中添加 pip install 命令,而该 Dockerfile 没有将 setup.py 复制到其上下文(例如 VSCode 开发容器)中,则可能会发生这种情况。将 pip 调用放在 postCreateCommand 中。

This can happen if you add a pip install command in a Dockerfile that doesn't have setup.py copied into its context, such as a VSCode dev container. Put the pip call in the postCreateCommand instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文