微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Snyk 测试返回 Failed to test pip 项目错误 解决方案信息文档

如何解决Snyk 测试返回 Failed to test pip 项目错误 解决方案信息文档

我正在使用 Snyk CLI 为 python 项目运行安全扫描。不幸的是,snyk test 命令返回无法测试 pip 项目错误。我错过了什么,snyk test 在扫描 npm 项目时工作正常吗?

$ snyk test --file=requirements.txt
Failed to test pip project

解决方法

我发现原因基本上你需要做两件事:

  • 确保安装了项目使用的包。
  • 确保您使用的是正确的 Python。

解决方案

$ pip3 install -r requirements.txt
$ snyk test --file=requirements.txt --command=python3

信息

您可以通过使用附加的 --allow-missing 参数通过 snyk 传递 -- pip 参数来绕过丢失的 python 包。

$ snyk test --file=requirements.txt --command=python3 -- --allow-missing

文档

-- [COMPILER_OPTIONS]
    Pass extra arguments directly to Gradle or Maven. E.g. snyk test
    -- --build-cache

Python options
    --command=COMMAND
        Indicate which specific Python commands to use based  on  Python
        version.  The  default is python which executes your systems de-
        fault python version. Run 'python -V' to find out  what  version
        is  it.  If you are using multiple Python versions,use this pa-
        rameter to specify the correct Python command for execution.

        Default: python Example: --command=python3

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。