安裝Anaconda
1.下載
wget https://repo.anaconda.com/archive/Anaconda3-5.0.1-Linux-x86_64.sh
- 安裝
在安裝包路徑下執(zhí)行:
bash Anaconda3-5.0.1-Linux-x86_64.sh
安裝過(guò)程中會(huì)需要不斷回車來(lái)閱讀并同意license炒辉。
安裝路徑默認(rèn)為用戶目錄(可以自己指定),最后需要確認(rèn)將路徑加入用戶的.bashrc中泉手。
- 編輯.bashrc文件
打開(kāi)文件
vi ~/.bashrc
# 編輯 .bashrc
在最后一行加入:
export PATH="$PATH:~/anaconda3/bin"
保存
最后黔寇,立即使路徑生效,需要在用戶目錄下執(zhí)行:(一定不要忘了執(zhí)行)
source ~/.bashrc
- 查看conda環(huán)境列表
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
# 附加庫(kù):
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
啟動(dòng)
~$ 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!! 設(shè)置編輯器
#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!! 設(shè)置圖像格式
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
設(shè)置環(huán)境變量
Cl>set terminal=vt100
一些報(bào)錯(cuò)的解決方式
1.conda install 時(shí)出錯(cuò): CondaError: Downloaded bytes did not match Content-Length
方法一
換源方法二
設(shè)置conda下載的timeout斩萌,然后再進(jìn)行嘗試缝裤,如果時(shí)長(zhǎng)不夠可以再設(shè)置大一點(diǎn)。
conda config --set remote_read_timeout_secs 600.0
然后運(yùn)行安裝命令
conda install 包 即可颊郎。方法三
從conda的源下載好要安裝的包憋飞,直接采用本地安裝的方式。下載的url再出錯(cuò)的地方有提示:
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
- 啟動(dòng)iraf時(shí)輸入cl報(bào)錯(cuò):/usr/local/bin/rar: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
原因:64位系統(tǒng)中安裝了32位程序
解決方法:
yum install glibc.i686
重新安裝以后還有如下類系錯(cuò)誤 再繼續(xù)安裝包
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 = '路徑'
- 關(guān)聯(lián)Jupyter Notebook和conda的環(huán)境和包——“nb_conda”
conda install nb_conda