(一) 安装环境
Windows 10
已安装 WSL2 Ubuntu-22.04
(二)下载和安装Miniconda
1. 下载Miniconda:
打开Ubuntu
在Ubuntu中输入
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
2.安装Miniconda
在Ubuntu中输入
bash Miniconda3-latest-Linux-x86_64.sh
(三)安装spyder
在Ubuntu中输入
conda install spyder
以及安装如下的包,使得spyder能够运行
sudo apt-get install libxcursor-dev
sudo apt-get install alsa
sudo apt install libegl1-mesa libegl1
(四)下载和安装X11
X11是为了能够在Linux子系统上打开Spyder界面。
1.下载X11
X11下载网址
2.安装配置X11
按默认选项安装X11
配置时,在“Display number”中输入0
按以下默认的选项,点"Next"
按以下选上“Disaable access control”,点“Next”
点“Save configuration”, 点“Finish”
我就把X11的配置文件放在文档啦~~~~~~
以下Private networks 和Public networks都要选上!
在安装完VcXscrv Windows X Server,在Ubuntu终端输入
nano ~/.bashrc
然后,在这一段最后贴入
DISPLAY=:0
export DISPLAY
LIBGL_ALWAYS_INDIRECT=1
Export LIBGL_ALWAYS_INDIRECT
如图
然后Ctrl X退出,再选yes,再输入enter。然后关闭Ubuntu,不然不会成功哦。
(五)在WSL Ubuntu中打开Spyder
1.先打开X11
2.就可以在Ubuntu中打开Spyder啦
(六)参考资料:
https://sqmao.medium.com/using-wsl2-to-set-up-a-spyder-ide-on-windows-10-3734139b554https://sqmao.medium.com/using-wsl2-to-set-up-a-spyder-ide-on-windows-10-3734139b554https://medium.com/@macasaetjohn/setting-up-a-spyder-environment-with-wsl-bb83716a44f3
https://medium.com/@macasaetjohn/setting-up-a-spyder-environment-with-wsl-bb83716a44f3
---------------------------------------------------------------------------------------------------------------------------------
希望可以帮助到你哦,有问题敬请联系本人1131062932@qq.com,一起交流!!!!
---------------------------------------------------------------------------------------------------------------------------------