我正在尝试使用Jupyter Notebook中的Julia从GitHub下载文件:
isfile("housing.data") ||
download("https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data",
"housing.data")
rawdata = readdlm("housing.data")'
我有Windows和Julia v1.1.1版本。我收到没有对我说什么的错误消息:
failed process: Process(`'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data', 'housing.data')"`, ProcessExited(3221225477)) [3221225477]
Stacktrace:
[1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
[2] pipeline_error at .\process.jl:785 [inlined]
[3] download(::String, ::String) at .\download.jl:20
[4] top-level scope at In[3]:1
我尝试搜索该消息,但找不到任何内容太久了,我没有找到与此类问题相关的任何主题。该错误的原因可能是什么?我需要为您提供其他信息吗?
答案 0 :(得分:1)
Base.download
依赖于系统命令的可用性和配置。特别是其文档内容如下:
“此功能依赖于外部工具(例如curl,wget或fetch)的可用性来下载文件,并且为了方便起见而提供。对于生产用途或需要更多选项的情况,请使用提供所需功能的软件包功能。”
请遵循以下建议:
using Pkg
Pkg.add("HTTP")
using HTTP
HTTP.download("https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data", "housing.data")
通过这种方式,您可以使用纯Julia来下载文件,而不是使用各种系统工具,并在跨平台的情况下保持代码的同类行为。