安装Anaconda
1.下载
wget https://repo.anaconda.com/archive/Anaconda3-5.0.1-Linux-x86_64.sh
- 安装
在安装包路径下执行:
bash Anaconda3-5.0.1-Linux-x86_64.sh
安装过程中会需要不断回车来阅读并同意license。
安装路径默认为用户目录(可以自己指定),最后需要确认将路径加入用户的.bashrc中。
- 编辑.bashrc文件
打开文件
vi ~/.bashrc
# 编辑 .bashrc
在最后一行加入:
export PATH="$PATH:~/anaconda3/bin"
保存
最后,立即使路径生效,需要在用户目录下执行:(一定不要忘了执行)
source ~/.bashrc
- 查看conda环境列表
conda info --envs
安装 Astropy 和 IRAF
https://faculty1.coloradocollege.edu/~sburns/courses/18-19/pc362/Anaconda_IRAF_install.html
步骤
换源
- conda添加源
# 附更换清华镜像源的方式:
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
# 附加库:
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels http://ssb.stsci.edu/astroconda
- 查看源
conda config --show
- 删除源
conda config --remove channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --remove-key channels # 删除所有源
安装
conda create -n iraf27 python=2.7 iraf-all pyraf-all stsci
启动
~$ source activate iraf27
(iraf27) ~$ mkdir iraf
(iraf27) ~$ cd iraf
(iraf27) iraf$ mkiraf
-- creating a new uparm directory
Terminal types: xgterm,xterm,gterm,vt640,vt100,etc.
Enter terminal type [default xterm-256color]: xgterm
A new LOGIN.CL file has been created in the current directory.
You may wish to review and edit this file to change the defaults.
You may also add additional customizations to loginuser.cl
编辑login.cl
# LOGIN.CL -- User login file for the IRAF command language.
# Identify login.cl version (checked in images.cl).
if (defpar ("logver"))
logver = "IRAF V2.16 March 2012"
set home = "/home/zy/iraf/"
set imdir = "./" # edit!!
set cache = "U_CACHEDIR"
set uparm = "home$uparm/"
set userid = "zy"
# Set the terminal type. We assume the user has defined this correctly
# when issuing the MKIRAF and no longer key off the unix TERM to set a
# default.
if (access (".hushiraf") == no)
print "setting terminal type to xgterm..."
stty xgterm
# Uncomment and edit to change the defaults.
set editor = vi # edit!! 设置编辑器
#set printer = lp
#set pspage = "letter"
#set stdimage = imt800
#set stdimcur = stdimage
#set stdplot = lw
#set clobber = no
#set imclobber = no
#set filewait = yes
#set cmbuflen = 512000
#set min_lenuserarea = 64000
set imtype = "fits" # edit!! 设置图像格式
set imextn = "oif:imh fxf:fits,fit fxb:fxb plf:pl qpf:qp stf:hhh,??h"
# XIMTOOL/DISPLAY stuff. Set node to the name of your workstation to
# enable remote image display. The trailing "!" is required.
#set node = "my_workstation!"
# CL parameters you mighth want to change.
#ehinit = "nostandout eol noverify"
#epinit = "standout showall"
showtype = yes
# Default USER package; extend or modify as you wish. Note that this can
# be used to call FORTRAN programs from IRAF.
package user
task $adb $bc $cal $cat $comm $cp $csh $date $dbx $df $diff = "$foreign"
task $du $find $finger $ftp $grep $lpq $lprm $ls $mail $make = "$foreign"
task $man $mon $mv $nm $od $ps $rcp $rlogin $rsh $ruptime = "$foreign"
task $rwho $sh $spell $sps $strings $su $telnet $tip $top = "$foreign"
task $awk $vi $emacs $w $wc $less $rusers $sync $pwd $gdb = "$foreign"
task $more = "$foreign"
# edit!!
task $xc $mkpkg $generic $rtar $wtar $buglog = "$foreign"
#task $fc = "$xc -h $* -limfort -lsys -lvops -los"
task $fc = ("$" // envget("iraf") // "unix/hlib/fc.csh" //
" -h $* -limfort -lsys -lvops -los")
task $nbugs = ("$(setenv EDITOR 'buglog -e';" //
"less -Cqm +G " // envget ("iraf") // "local/bugs.*)")
task $cls = "$clear;ls"
task $clw = "$clear;w"
task $pg = ("$(less -Cqm $*)")
if (access ("home$loginuser.cl"))
cl < "home$loginuser.cl"
;
keep
# Load the default CL package. Doing so here allows us to override package
# paths and load personalized packages from our loginuser.cl.
clpackage
# List any packages you want loaded at login time, ONE PER LINE.
images # general image operators
plot # graphics tasks
dataio # data conversions, import export
lists # list processing
# The if(deftask...) is needed for V2.9 compatibility.
if (deftask ("proto"))
proto # prototype or ad hoc tasks
tv # image display
utilities # miscellaneous utilities
noao # optical astronomy packages
vo # Virtual Observatory tools
plot
prcache directory
cache directory page type help
# Print the message of the day.
if (access (".hushiraf"))
menus = no
else {
type hlib$motd
}
# Uncomment to initialize the SAMP interface on startup.
if (deftask ("samp") == yes) {
printf ("Initializing SAMP .... ")
if (sampHubAccess() == yes) {
# Enable SAMP messaaging. Set default handlers that don't require
# VO capabilities.
samp quiet
samp ("on", >& "dev$null")
# samp ("handler", "table.load.votable", "tinfo $url", >& "dev$null")
# samp ("handler", "image.load.fits", "imstat $url", >& "dev$null")
samp noquiet
print ("on")
} else
print ("No Hub Available\n")
}
# Delete any old MTIO lock (magtape position) files.
if (deftask ("mtclean"))
mtclean
else
delete uparm$mt?.lok,uparm$*.wcs verify-
keep
设置环境变量
Cl>set terminal=vt100
一些报错的解决方式
1.conda install 时出错: CondaError: Downloaded bytes did not match Content-Length
方法一
换源方法二
设置conda下载的timeout,然后再进行尝试,如果时长不够可以再设置大一点。
conda config --set remote_read_timeout_secs 600.0
然后运行安装命令
conda install 包 即可。方法三
从conda的源下载好要安装的包,直接采用本地安装的方式。下载的url再出错的地方有提示:
url: http://ssb.stsci.edu/astroconda/linux-64/iraf-2.16.UR.1-0.tar.bz2
离线安装:
conda install --offline ./iraf-2.16.UR.1-0.tar.bz2
- 启动iraf时输入cl报错:/usr/local/bin/rar: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
原因:64位系统中安装了32位程序
解决方法:
yum install glibc.i686
重新安装以后还有如下类系错误 再继续安装包
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
yum install libstdc++.so.6
conda安装ds9
conda install -c pkgw/label/superseded ds9
jupyter notebook配置
- 修改jupyter_notebook_config.py
jupyter notebook --generate-config
vi /home/zy/.jupyter/jupyter_notebook_config.py
作如下修改:
c.NotebookApp.allow_root = Ture
c.NotebookApp.notebook_dir = '路径'
- 关联Jupyter Notebook和conda的环境和包——“nb_conda”
conda install nb_conda