无法在Julia简单脚本中使用load函数。

huangapple go评论61阅读模式
英文:

Can't use load function in julia simple script

问题

I'm trying to load an image in Julia but it gives me the error:

> ERROR: UndefVarError: load not defined
Stacktrace:
> 1 top-level scope
> @ c:\folde1\folder2\project.jl

My code is:

using TestImages, Images, Statistics, Plots
a = load("rachado1.jpeg")

I'm running the code using vscode with Julia v1.9.
I already tried installing many packages (FileIO, ImageIO, ImageMagick), but the error persists.

I also tried in colab following these instructions (Julia in colab) and adding a new cell using the script above. But I got the same error.

英文:

I'm trying to load a image in Julia but it gives me the error:

> ERROR: UndefVarError: load not defined
Stacktrace:
> 1 top-level scope
> @ c:\folde1\folder2\project.jl

My code is:

using TestImages, Images, Statistics, Plots
a = load("rachado1.jpeg")

I'm running the code using vscode with Julia v1.9
I already tried installing many packages (FileIO, ImageIO, ImageMagick), but the error persists.

I also tried in colab following these instructions (Julia in colab) and adding a new cell using the script above. But I got the same error.

答案1

得分: 2

正如丹·盖茨所说,问题不是导入FileIO:


# 尝试加载图像
img = load("test.jpg") # 错误:UndefVarError: load未定义


using FileIO # 现在首先导入FileIO

img = load("test.jpg") # 现在成功加载

希望对你有帮助!

英文:

as Dan Getz said, the issue is not importing FileIO:


# Try to load the image
img = load("test.jpg") # ERROR: UndefVarError: load not defined


using FileIO # now instead import FileIO first

img = load("test.jpg") # it now loads successfully

hope this helps!

huangapple
  • 本文由 发表于 2023年6月13日 03:42:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459833.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定