Julia - 如何在 Julia 版本 0.6.4 中更新 WinRPM

3

我是Julia的新手,想要使用COBRA包。 添加COBRA时,我使用以下命令:

Pkg.add("COBRA")

但是在运行时,我遇到了以下错误:

信息:正在构建WinRPM

警告:跳过repodata/repomd.xml,不在缓存中--调用WinRPM.update()进行下载

警告:跳过repodata/repomd.xml,不在缓存中--调用WinRPM.update()进行下载

信息:正在下载https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml

警告:未知的下载失败,错误代码:2148270086

警告:重试下载 1/5: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml

直到:

警告:未知的下载失败,错误代码:2148270086

警告:重试下载 5/5: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml

警告:下载时收到错误0 https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml

在出现这些错误后,我检查了链接,发现源已经不存在了。 然后我按照上面的指示运行了以下命令:

WinRPM.update()

但它抛出了这个错误:

错误:UndefVarError: WinRPM未定义

请帮助我在Julia中添加COBRA。我正在使用版本0.6.4,因为Cobra在后续版本上无法工作。(Windows 10) 非常感谢您的任何帮助。

1个回答

1
正如您所提到的,问题在于包使用的原始源不再是有效的URL。解决这个问题的正确方法是向包中提交一个拉取请求来更改URL(我现在已经在这里完成了)。作为临时措施,以下是一个临时的hacky方法来解决这个问题:
  • 执行Pkg.add("WinRPM")。这可能会触发与上面相同的警告,请忽略这些警告。
  • 接下来,使用using WinRPM来加载我们添加的包
  • 现在,源URL从sources.list文件(上面链接)读入到全局的WinRPM.sources变量中。我们将编辑这个变量的内容,以指向新的工作URL。(这通常是一个可怕的想法,直接插手模块的内部并改变东西。)

julia> WinRPM.sources[:] = replace.(WinRPM.sources, "Leap_42.3" => "Leap_15.3")
2-element Vector{String}:
 "https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_15.3"
 "https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_15.3"

  • 现在应该可以使用 WinRPM.update(),并将下载内容存储到本地缓存中。

我正在使用版本0.6.4,因为Cobra在后续版本上不起作用。

我希望你是指Julia 1.6.4版本,或者堆栈中其他某个组件的0.6.4版本。如果你指的是Julia 0.6.4版本,那么你可能会在以后遇到更多问题,并且很难获得针对这样一个旧版本的支持。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接