一 、win10 安装Ubuntu 子系统(WSL)
在应用商店搜索框里搜索Windows Terminal,即可找到这个软件。
2.安装Ubuntu子系统
如下图,在控制面板,找到程序选项,点击 “启用或关闭Windows功能”。
从弹出的对话框里,划到最下边,然后给“适用于Linux的Windows子系统“,打勾,完事!
从应用商店安装Ubuntu系统,这个系统将会以软件的形式存在。我这里选择的是LTS版本。
2.事后配置在我们的Windows Terminal右上角,有一个向下的箭头,点击它,就可以看到刚刚安装的Ubuntu。
正在上传…重新上传取消正在上传…重新上传取消进入Linux系统之后,我们就可以像配置一个普通Linux一样配置这台机器。首先把ubuntu的软件源给换掉。编辑/etc/apt/sources.list文件,把它的内容换成下面的源。
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
我们Linux系统中的文件,在Windows中如何访问呢?这个就有点魔幻了。在Linux下执行下面的命令。
cd /home explorer.exe .
上面的命令,即可打开Linux目录对应的Windows目录,从文件管理器中我们就可以访问到。为了操作方便,我把这个长长的目录,映射到了Z盘上。如图,下次在访问Linux的时候,直接访问Z盘就可以了。
二、安装anaconda
- 下载地址:
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86.sh
- 安装:
把安装包放到Ubuntu主目录下(/home),
在终端输入:
cd /home
bash Miniconda3-latest-Linux-x86.sh
一直按回车建,输入’’yes’’
安装成功后重启终端!!
4.升级conda:
终端输入:conda update conda
- 创建虚拟环境环境:
(1)创建python3.7环境
终端输入:conda create -n py37 python=3.7
(2)创建python2.7环境
终端输入:conda create -n py27 python=2.7
激活环境:conda activate py37 (py27)
关闭环境:conda deactivate py37(py27)
三、安装3ML
1.在终端输入: conda create --name threeML -c conda-forge python=3.7 numpy scipy matplotlib
2.在终端输入: conda activate threeML conda install -c conda-forge -c threeml astromodels threeml 3.在终端输入: conda install -c xspecmodels xspec-modelsonly
- 安装jupyter lab
- 打开python3环境
在终端输入:conda activate py37
- 安装jupyterlab
在终端输入:pip install jupyterlab
- 配置jupyterlab
(1)终端输入:jupyter notebook --generate-config
成的配置文件位于 ~/.jupyter/jupyter_notebook_config.py
(2)终端输入:ipython
from notebook.auth import passwd
passwd()
输入密码后得到一串符号将其复制
exit()退出ipyhon;
(3)打开jupyter配置文件
终端输入: vim ~/.jupyter/jupyter_notebook_config.py
将以下内容复制粘贴上去:
c.ServerApp.ip='localhost'
c.ServerApp.password=u'argon2:$argon2id$v=19$m=10240,t=10,p=8$WtY84f4vLWvcfq0HqlQJjw$zLRJ1yuxWtHGqFcOQ8X5yQ'(刚才得到的那串符号)
c.ServerApp.open_browser = False
c.ServerApp.port =8888 #
保存退出!
- 启动jupyter lab
终端输入:jupyter lab
浏览器中输入:localhost:8888
出现jupyterlab登陆页面,安装成功!
则会看到以下内容:



