How do I check what version of Julia is running my code?

Viewed 165

is there a way to Check what version of Julia is running the code? this matters when you already have more than 1 Julia on your machine.

2 Answers

To find where is Julia located try:

type -a julia

On a Windows machine where julia will be useful:

$ where julia
c:\Julia-1.7.1\bin\julia.exe

To find the actual version just do julia -version:

$ julia -version
julia version 1.7.1

When inside Julia there is a special VERSION variable of type VersionNumber:

julia> dump(VERSION)
VersionNumber
  major: UInt32 0x00000001
  minor: UInt32 0x00000007
  patch: UInt32 0x00000001
  prerelease: Tuple{} ()
  build: Tuple{} ()

This variable can also be reached from console (Windows version of this code will require " instead of ':

$ julia -e 'println(VERSION)'
1.7.1

Finally you might want to check which Julia is actually running your current code:

julia> Base.julia_cmd()
`'c:\Julia-1.7.1\bin\julia.exe' -Cnative '-Jc:\Julia-1.7.1\lib\julia\sys.dll' -g1`

julia> Base.julia_cmd()[1]
"c:\\Julia-1.7.1\\bin\\julia.exe"

Last but not least, sometimes you will just want to use versioninfo():

julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_DEPOT_PATH = C:\JuliaPkg\Julia-1.7.1

The VERSION constant gives you the version number.

Related