【问题标题】:How to use NuGet package in Python?如何在 Python 中使用 NuGet 包?
【发布时间】:2021-03-18 18:36:25
【问题描述】:

我们希望在 Python 代码中使用 Azure Artifacts 中的 NuGet 包。 我们能够在 Python 中使用来自 NuGet 库的 DLL 和程序集,但在这里我们特别想使用另一个团队在 Azure Artifacts 上构建和部署的 NuGet 包。

以下是我们目前能够编写的代码:

import clr
import unittest

clr.AddReference("System.Security.Cryptography.Algorithms")

def test(self):
    self.assertTrue(issubclass(type(System.Security.Cryptography.MD5.Create()),System.Security.Cryptography.MD5))

unittest.main()

【问题讨论】:

标签: python azure nuget azure-artifacts


【解决方案1】:

您需要使用NuGet command line 安装包,将所需的.dll 文件复制到您的项目文件夹,然后使用clr.AddReferenceToFile('filePathToPackageDll') 添加引用。

nuget sources add -Name <SourceName> -Source <SourceURL> -username <UserName> -password <Pat>
nuget.exe restore

【讨论】:

  • 你查看我的回复了吗?我的回复有用吗?
  • 是的,我们做到了,不幸的是,这不是我们想要的方式。
猜你喜欢
  • 2016-07-24
  • 2021-08-18
  • 1970-01-01
  • 1970-01-01
  • 2017-01-02
  • 2016-05-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多