查找 Julia jl 文件

我是 Julia 的新手,刚刚完成我的第一个项目。我在 Julia 工作室编写了代码,并在程序中进行了测试。它提供了所有正确的输出,但是 shell 将输出分隔开,就好像它是两个不同的执行。

我想知道我的编译器是否有问题,所以我想我可以尝试在 julialang.org 上找到的缺省的 julia shell 中编译它。

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

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

输出示例:

 julia> program
#
#
#
#




julia>
#
#
#
#
#

# 表示整数。理想情况下,输出不应该被“ julia >”分隔开

111641 次浏览

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

/path/to/julia script-name.jl

In the shell of your choice.

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.

Look into using IJulia w/in Jupyter Notebook: https://github.com/JuliaLang/IJulia.jl

You can chmod your script and put the path to the julia binary at the to line.

Consider the following simple script hello.jl

#!/usr/bin/julia
println("Hello world")

change permission on the script using

chmod a+x hello.jl

Run the script using ./hello.jl

You also can use IntelliJ IDEA with the plugin of Julia ... That's a surprise

step 1: Open terminal

step 2: go to your Julia file location

step 3: execute the julia file

/path/to/folder script-julia.jl

Hit the up arrow, if it helps you. Thank you.

You're using the REPL. That works, but what I do is to go to command line and navigate to the folder like this (this is specifically for me, you will need to find the path directory to your file):

cd\users\yourname\desktop\code\julia

and to run the program:

julia filename.jl

its this simple (I guess)

if you want to import a Julia file to another Julia file, you should use the following command:

include("path-to-your-file.jl")