安装
- 下载Julia。选择
Generic Linux binaries
版本。直接解压,并在~/bin
下输入julia
即可。
Windows
1
|
C:\Users\lenovo\AppData\Local\Programs\Julia-1.9.2\bin
|
或,
一键增加环境变量,add_path.bat
,
1
2
3
4
5
6
7
8
9
10
11
|
@echo off
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set evname1=JULIA_DEPOT_PATH
set evname2=JULIA_PKG_SERVER
set path1=%~dp0bin
set path2=%~dp0.julia
set path3=https://mirrors.sjtug.sjtu.edu.cn/julia/
reg add "%regpath%" /v %evname1% /d %path2% /f
setx /m path "%path%;%path1%"
reg add "%regpath%" /v %evname2% /d %path3% /f
pause>nul
|
一键删除环境变量,delete_path.bat
,
1
2
3
4
5
6
7
8
9
10
|
@echo off
setlocal enabledelayedexpansion
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set evname1=JULIA_DEPOT_PATH
set evname2=JULIA_PKG_SERVER
set path1=%~dp0bin
reg delete "%regpath%" /v "%evname1%" /f
setx /m path "!path:%path1%;=!"
reg delete "%regpath%" /v "%evname2%" /f
pause>nul
|
修改C:\Users\lenovo\AppData\Local\Programs\Julia-1.9.2\etc\julia\startup.jl
,
1
2
3
|
# This file should contain site-specific commands to be executed on Julia startup;
# Users may store their own personal commands in `~/.julia/config/startup.jl`.
ENV["JULIA_PKG_SERVER"]="https://mirrors.sjtug.sjtu.edu.cn/julia/"
|
1
2
3
4
5
6
7
8
9
10
11
12
|
julia> versioninfo()
Julia Version 1.9.2
Commit e4ee485e90 (2023-07-05 09:39 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 24 × 12th Gen Intel(R) Core(TM) i9-12900HX
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)
Threads: 1 on 24 virtual cores
Environment:
JULIA_PKG_SERVER = https://mirrors.sjtug.sjtu.edu.cn/julia/
|
Linux
1
2
3
4
5
6
7
8
9
|
cd /opt/ohpc/pub/apps/julia-1.10.1
echo "USEICC = 0" >> Make.user
echo "USEIFC = 0" >> Make.user
echo "USE_INTEL_MKL = 1" >> Make.user
echo "USE_INTEL_LIBM = 1" >> Make.user
make -j $((`nproc`-1))
# make -j $((`nproc`-1)) 1> build_log.txt 2> build_error.txt
|
1
2
3
|
# julia
export PATH=$PATH:/opt/ohpc/pub/apps/julia-1.10.1/bin
export JULIA_PKG_SERVER=https://mirrors.sjtug.sjtu.edu.cn/julia/
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
julia> versioninfo()
Julia Version 1.10.1
Commit 7790d6f064 (2024-02-13 20:41 UTC)
Build Info:
Note: This is an unofficial build, please report bugs to the project
responsible for this build and not to the Julia project unless you can
reproduce the issue using official builds available at https://julialang.org/downloads
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: 40 × Intel(R) Xeon(R) Silver 4210 CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, cascadelake)
Threads: 1 default, 0 interactive, 1 GC (on 40 virtual cores)
Environment:
LD_LIBRARY_PATH = /opt/ohpc/pub/apps/intel2022/itac/2020.3.036/intel64/slib:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/compiler/lib/intel64_lin:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mpi/intel64/libfabric/lib:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mpi/intel64/lib/release:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mpi/intel64/lib:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/ipp/lib/intel64:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64_lin:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/tbb/lib/intel64/gcc4.8:/opt/ohpc/pub/apps/intel2022/debugger_2020/python/intel64/lib:/opt/ohpc/pub/apps/intel2022/debugger_2020/libipt/intel64/lib:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/daal/lib/intel64_lin:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/daal/../tbb/lib/intel64_lin/gcc4.4:/opt/ohpc/pub/apps/intel2022/compilers_and_libraries_2020.4.304/linux/daal/../tbb/lib/intel64_lin/gcc4.8:/opt/ohpc/pub/compiler/gcc/8.3.0/lib64:/opt/ohpc/pub/apps/tensorflow/TensorRT-7.2.3.4/targets/x86_64-linux-gnu/lib
JULIA_PKG_SERVER = https://mirrors.sjtug.sjtu.edu.cn/julia/
|
运行
1
2
3
4
|
julia> using Pkg; Pkg.status()
Status `C:\Users\lenovo\.julia\environments\v1.9\Project.toml`
[052768ef] CUDA v4.4.0
[acf6eb54] DFTK v0.6.9
|
1
2
3
|
using Pkg
Pkg.add()
Pkg.rm()
|
1
2
3
4
|
using Pkg; Pkg.add(PackageSpec(url="https://github.com/WMD-group/CarrierCapture.jl"))
Pkg.add("Plots"); Pkg.add("LaTeXStrings");Pkg.add("DataFrames")
# import Pkg; Pkg.precompile()
using CarrierCapture
|
1
2
3
4
|
using Pkg; Pkg.add("PyCall")
ENV["PYTHON"]="C:/Users/lenovo/anaconda3/python.exe"
Pkg.build("PyCall")
using PyCall
|
报错
1
2
3
4
5
6
7
8
9
10
11
12
13
|
julia> using Pkg; Pkg.add("PyCall")
┌ Error: curl_easy_setopt: 48
│
│ You may be using an old system libcurl library that doesn't understand options that Julia uses. You can try the following Julia code to see which libcurl library you are using:
│
│ using Libdl
│ filter!(contains("curl"), dllist())
│
│ If this indicates that Julia is not using the libcurl library that is shipped with Julia, then that is likely to be the problem. This either means:
│
│ 1. You are using an unofficial Julia build which is configured to use a system libcurl library that is not recent enough; you may be able to fix this by upgrading the system libcurl. You should complain to your distro maintainers for allowing Julia to use a too-old libcurl version and consider using official Julia binaries instead.
│
│ 2. You are overriding the library load path by setting `LD_LIBRARY_PATH`, in which case you are in advanced usage territory. You can try upgrading the system libcurl, unsetting `LD_LIBRARY_PATH`, or otherwise arranging for Julia to load a recent libcurl library.
|
解决
修改.bashrc
,
1
|
export LD_LIBRARY_PATH=/opt/ohpc/pub/apps/julia/julia-1.10.7/lib/julia:$LD_LIBRARY_PATH
|
1
|
using Pkg; Pkg.add(["Flux", "CUDA", "cuDNN", "ProgressMeter"])
|
1
|
using Pkg; Pkg.add("MLJ")
|
1
|
import Pkg; Pkg.add("Lux")
|
1
|
using Pkg; Pkg.add("SymbolicRegression")
|
1
|
using Pkg; Pkg.add("XGBoost")
|
1
|
using Pkg; Pkg.add("DifferentialEquations")
|
1
|
import Pkg; Pkg.add("Plots")
|
1
|
import Pkg; Pkg.add("DFTK")
|
1
|
import Pkg; Pkg.add("Zygote")
|
1
|
using Pkg; Pkg.add(["Printf", "LinearAlgebra", "IterativeSolvers", "ForwardDiff", "ReverseDiff", "ASEconvert"])
|
1
|
import Pkg; Pkg.add("ReinforcementLearning")
|
1
|
import Pkg; Pkg.add("Turing")
|
1
|
using Pkg; Pkg.add(["BenchmarkTools", "Distributed"])
|
1
|
import Pkg; Pkg.add("JuMP")
|
1
|
using Pkg; Pkg.add("Optimization")
|
1
|
using Pkg; Pkg.add("GLMakie")
|
1
|
using Pkg; Pkg.add("DataFrames")
|
1
|
using Pkg; Pkg.add("UnicodePlots")
|
1
|
using Pkg; Pkg.add("ModelingToolkit")
|
1
|
using Pkg; Pkg.add("PyPlot")
|
代理
临时设置
1
2
|
ENV["http_proxy"] = "socks5://127.0.0.1:7890"
ENV["https_proxy"] = "socks5://127.0.0.1:7890"
|
1
2
|
ENV["http_proxy"] = ""
ENV["https_proxy"] = ""
|
永久设置
- 打开
C:\Users\lenovo\AppData\Local\Programs\Julia-1.10.7\etc\julia\startup.jl
,
1
2
3
|
ENV["JULIA_PKG_SERVER"] = "https://mirrors.sjtug.sjtu.edu.cn/julia"
ENV["http_proxy"] = "socks5://127.0.0.1:7890"
ENV["https_proxy"] = "socks5://127.0.0.1:7890"
|
- 打开
/opt/ohpc/pub/apps/julia/julia-1.10.7/etc/julia/startup.jl
,
1
2
3
|
ENV["JULIA_PKG_SERVER"] = "https://mirrors.sjtug.sjtu.edu.cn/julia"
ENV["http_proxy"] = "socks5://10.91.96.230:7890"
ENV["https_proxy"] = "socks5://10.91.96.230:7890"
|
Notepad++
Notepad++调用
在Notepad++中运行
-运行
,输入以下代码,
1
|
cmd /k julia "$(FULL_CURRENT_PATH)" & PAUSE & EXIT
|
Notepad++语法高亮
下载Julia_Notepad++.xml,放置于~\npp.7.5.5\plugins\APIs
,然后在语言
-自定义语言格式
中导入。
Notepad++关联.jl文件
新建.reg
,加入,
1
2
3
4
|
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\.jl]
[HKEY_CURRENT_USER\Software\Classes\.jl\shell]
[HKEY_CURRENT_USER\Software\Classes\.jl\shell\open]
|
然后在Win10设置中搜索选择文件类型和每个应用打开的协议
,将jl
文件默认程序指定为Notepad++即可。
文档