运行 Julia .jl 文件 [英] Running Julia .jl files

查看:24
本文介绍了运行 Julia .jl 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 julia 的新手,刚刚完成我的第一个程序.我在 julia-studio 中编写了代码,并一直在该程序中对其进行测试.它为我提供了所有正确的输出,但 shell 将输出分开,就好像它是两个不同的执行一样.

I'm new to julia and just finished my first program. I wrote the code in julia-studio and have been testing it within that program. It gives me all of the correct output, but the shell separates the output as if it is two different executions.

我想知道这是否是我的编译器的问题,所以我想我会尝试在 julialang.org 上找到的默认 julia shell 中编译它.

I'm wondering if it's a problem with my compiler, so I thought I would try compiling it in the default julia shell found at julialang.org.

但是,我无法理解和/或弄清楚如何在那里运行它.我当前的程序从同一目录中的另一个文件读取输入并输出结果.

However, I cannot understand and/or figure out how to run it there. My current program reads input from another file in the same directory and outputs the results.

谁能解释一下如何运行这个程序.这http://julia.readthedocs.org/en/latest/manual/getting-started/ 对我来说没有意义.

Can anyone explain how to run the program. This http://julia.readthedocs.org/en/latest/manual/getting-started/ isn't making sense to me.

示例输出:

 julia> program
 #
 #
 #
 #


 julia> 
 #
 #
 #
 #
 #

# 代表整数.理想情况下,输出不应由julia>"

The # represents integer numbers. Ideally the output should not be seperated by "julia>"

推荐答案

如果你想从命令行运行 julia 脚本,那么就这样做

If you want to run the julia script from a command line then just do

/path/to/julia script-name.jl

在您选择的外壳中.

如果你想从 julia repl 运行它,那么你需要这样的东西:

If you want to run it from the julia repl then you want something like so:

julia> include("path/to/script-name.jl")

至于为什么您的输出会这样拆分,我认为我们需要查看您的代码.

As to why your output is split like that I think we would need to see your code.

这篇关于运行 Julia .jl 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆