Advertisement
kyoo0000

startup.jl

Oct 10th, 2020 (edited)
4,179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 0.99 KB | None | 0 0
  1.  
  2. using Pkg
  3.  
  4. startup_packages = [:OhMyREPL, :DataStructures]
  5. for pack in startup_packages
  6.    try
  7.       eval(:(using $(pack)))
  8.       printstyled("$(pack) is loaded.\n"; color=:light_green)
  9.    catch e
  10.       if isa(e, ArgumentError)
  11.          printstyled("The $(pack) isn't installed loaded.\nIntalling $(pack).\n"; color=:light_blue)
  12.          Pkg.add("$(pack)")
  13.       end
  14.          eval(:(using $(pack)))
  15.    end
  16. end
  17.  
  18. println()
  19.  
  20. # Check whether any package at 'needed_packages' are installed.
  21. # Case it's not installed, install them.
  22. needed_packages = [:Genie, :ScikitLearn, :IJulia]
  23. for pack in needed_packages
  24.    try
  25.       printstyled("Checking if package $(pack) is installed: "; color=:light_cyan)
  26.       isdir(Pkg.dir("$(pack)"))
  27.       printstyled("Ok\n"; color=:light_green)
  28.    catch e
  29.       if isa(e, MethodError)
  30.          printstyled("The $(pack) isn't installed loaded.\nIntalling $(pack).\n"; color=:light_magenta)
  31.          Pkg.add("$pack")
  32.       end
  33.    end
  34. end
  35.  
  36. println()
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement