Ubuntu下安装Julia

来源:互联网 发布:能耗监控分析软件 编辑:程序博客网 时间:2024/04/23 23:35

需要在Julia下进行编程。首先我们需要安装ubuntu14-desktop版本。然后在此基础上安装julia。

1.首先需要在线下载julia的源程序,为了下载源程序,我们必须更新各种包。在终端下执行sudo apt-get update来更新包。

2.安装编译需要的包,执行sudo apt-get install 包名 来安装程序。

GNU make —building dependencies.

gcc和g++ —compiling and linking C, C++

clang — clang isthe default compiler on OS X (Need at least v3.1, Xcode 4.3.3 on OS X)

gfortran —compiling and linking fortran libraries

git — versioncontrol and package management.

perl —preprocessing of header files of libraries.

wget或curl或fetch (FreeBSD) — to automatically download external libraries.

m4 — needed tobuild GMP.

patch — formodifying source code.

还有这个包libncurses5-dev

建议安装方法见附注1.

3.下载Julia源码包

git clonegit://github.com/JuliaLang/julia.git

或者

git config--global url."https://".insteadOf git://

4.全部下载完成后,进入julia目录cd julia/

执行make命令。

等待大约两个小时,安装完成。

5.安装完成,在根目录下执行julia/julia就可以了。

6.命令行下执行export PATH=~/julia/:$PATH可以配置path变量 配置环境变量方法见附注2

这样可以直接执行julia来跑命令了。

7.执行简单测试程序1+1回车,输出2。typeof(ans)输出Int32

         Tips:

         1.请查看您是否正以root用户运行

sudo -i输入密码之后切换到root用户

或者sudo apt-get install julia

 

2.注意事项

Linux

GCC version 4.6or later is recommended to build Julia.

If the buildfails trying to compile OpenBLAS, set OPENBLAS_TARGET_ARCH to BARCELONA on AMD,or NEHALEM on Intel CPUs in Make.inc and build again.

On some Linuxdistributions you may need to change how the readline library is linked. If youget a build error involving readline, setUSE_SYSTEM_READLINE=1 in Make.user.

On Ubuntusystems, you may also need to install the package libncurses5-dev.

On CentOS 5systems, the default compiler (gcc 4.1) is too old to build Julia.

附注:1.第二部分安装各种包,可以使用一条命令安装多个包,命令格式为:sudo apt-get install perl wget m4

将需要安装的包名依次列出即可。

附注2.为了使以后不必每次都使用export设定环境变量,可以设置配置里的环境变量,具体步骤如下:

1.管理员权限打开/etc/profile文件 sudo vim /etc/profile

2.最后一行添加如下指令 export PATH=/julia/:$PATH

3.执行source /etc/profile命令

4.现在就可以直接使用julia命令了