Start using Julia#
See Julia in Visual Studio Code for details.
Installation#
Install Julia in the official website or via the Windows store.
Install Julia extension for VS Code. See alos Julia extension’s website.
(Optional) Install Jupyter extension for VS Code for opening and running Jupyter notebooks in VS Code.
Running Julia in VS Code#
Julia extension will be automatically activated upon opening a Julia file (*.jl
).
You can open the command pallete (Ctrl + Shift + P
in windows) and search “Julia” for available commands and keyboard shortcuts. The most used on is Shift + Enter
: to execute the current selected line.
Package management in Julia#
In regular environments Project.toml
and Manifest.toml
describe the dependencies.
Install packages#
In the Julia script
using Pkg
# Function form
Pkg.add("Plots")
# Or use Pkg's special strings
pkg"add Plots"
In the Julia REPL:
] add Plots
See installed packages#
using Pkg
Pkg.status()
# Or
pkg"st" # pkg"status"
In the Julia REPL:
] st
Remove packages#
using Pkg
Pkg.remove("Plots")
# Or
pkg"rm Plots"
] rm Plots
Update installed packages#
using Pkg
Pkg.update()
# Or
pkg"up" # pkg"update"
Create / Use a environment#
using Pkg
# Activate environment in the foldername directory
Pkg.activate("foldername")
# Or activate the current working directory
# current_project() is a little bit misleading
# since it actually looks for available Project.toml file
Pkg.activate(".")
# Install the packages according to the environment
Pkg.instantiate()
# If the above failed, try this
Pkg.resolve()