Last active
January 24, 2018 20:32
-
-
Save ahogen/cd285eccdb912c1f262009a521773f39 to your computer and use it in GitHub Desktop.
Install and setup Plots with PyPlot backend using system Python in for Julia. Then builds system-specific Julia image for faster performance in the future.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: Both Julia and Python must be of the same architecture type. If Julia | |
# is 64-bit, so must your Python distribution. | |
# | |
# I tested this with a clean Julia install, by installing Julia and | |
# deleting "C:\Users\<username>\.julia". | |
# | |
# Julia: v6.1 | |
# Python: v3.6.3 for Windows | |
# | |
test_after_install = true | |
Pkg.update() | |
# Must point to actual python.exe, not just python dir | |
if is_linux() | |
ENV["PYTHON"] = "python3" | |
elseif is_windows() | |
//ENV["PYTHON"] = "C:/Users/Alex/AppData/Local/Programs/Python/Python36/python.exe" | |
ENV["PYTHON"] = "EDITME" # <<---- EDIT THIS LINE | |
end | |
python = ENV["PYTHON"] | |
run(`$python -m pip install --upgrade --user pip`) | |
run(`$python -m pip install --upgrade --user numpy`) | |
run(`$python -m pip install --upgrade --user matplotlib`) | |
run(`$python -m pip install --upgrade --user scipy`) | |
Pkg.add("PyCall") | |
Pkg.build("PyCall") | |
Pkg.add("PyPlot") | |
Pkg.add("Plots") | |
Pkg.build("Plots") | |
# Build system image | |
# From: #7 http://www.stochasticlifestyle.com/7-julia-gotchas-handle/ | |
if is_windows() | |
Pkg.add("WinRPM"); | |
using WinRPM | |
WinRPM.install("gcc", yes=true) | |
WinRPM.install("winpthreads-devel", yes=true) | |
end | |
include(joinpath(dirname(JULIA_HOME),"share","julia","build_sysimg.jl")); build_sysimg(force=true) | |
if test_after_install | |
using PyPlot | |
display(plot(rand(100))) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment