目錄
一、安裝WSL(適用于 Linux 的 Windows 子系統(tǒng))
檢查內(nèi)核版本號
WSL 版本升級
二、WSL安裝Anaconda(建議選擇方法2)
1.下載到WSL
2.下載到Windows
換源
三、conda常用命令
查看當(dāng)前python版本
查看配置信息
?編輯
查看環(huán)境列表
激活環(huán)境
退出環(huán)境
conda使用文檔
四、Windows上Pycharm使用WSL的虛擬環(huán)境
五、遠(yuǎn)程開發(fā)——使用 SSH 在另一臺主機(jī)上WSL 實(shí)例
一、安裝WSL(適用于 Linux 的 Windows 子系統(tǒng))
參照前文:
Windows11安裝Linux子系統(tǒng)(Ubuntu22.04LTS)+安裝ROS_Qomolangma_H的博客-CSDN博客https://blog.csdn.net/m0_63834988/article/details/128672234?spm=1001.2014.3001.5501
檢查內(nèi)核版本號
uname -r
WSL 版本升級
- Windows終端輸入
wsl --update
- Linux輸入
wsl.exe --update
或
sudo apt install wsl
二、WSL安裝Anaconda(建議選擇方法2)
-
1.下載到WSL
wget https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh
下載完成后輸入:
bash Anaconda3-2023.07-1-Linux-x86_64.sh
下面開始敲n次enter后,直到出現(xiàn)下圖界面,輸入yes確認(rèn)安裝(注意不要敲過頭,否則只能重新開始。。。)
?enter確認(rèn)安裝
開始安裝,不出意外的話就要出意外了,報(bào)錯(cuò)來了
WARNING: md5sum mismatch of tar archive
expected: b35af0fae8e8667609722e2c0d196f1d
? ? ?got: 42fbddf5a8a1e7fbfbec459facca6bf3 ?-
Unpacking payload ...
Traceback (most recent call last):
? File "entry_point.py", line 76, in <module>
? File "tarfile.py", line 2045, in extractall
? File "tarfile.py", line 2086, in extract
? File "tarfile.py", line 2159, in _extract_member
? File "tarfile.py", line 2208, in makefile
? File "tarfile.py", line 249, in copyfileobj
tarfile.ReadError: unexpected end of data
[1582] Failed to execute script 'entry_point' due to unhandled exception!
啊,chatgpt說……
根據(jù)您提供的報(bào)錯(cuò)信息,出現(xiàn)了兩個(gè)問題:MD5校驗(yàn)和不匹配以及解壓縮過程中出現(xiàn)了意外的數(shù)據(jù)結(jié)尾。
針對這個(gè)問題,您可以嘗試以下解決方法:
重新下載文件:刪除當(dāng)前下載的tar文件,并嘗試重新下載它。確保下載過程中沒有發(fā)生網(wǎng)絡(luò)中斷或其他問題??梢允褂靡韵旅钪匦孪螺d文件:
wget https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh
驗(yàn)證文件完整性:下載完成后,使用MD5校驗(yàn)和工具(如
md5sum
命令)驗(yàn)證文件的完整性。確保下載的文件的MD5校驗(yàn)和與預(yù)期值匹配??梢允褂靡韵旅铗?yàn)證文件的MD5校驗(yàn)和:md5sum Anaconda3-2023.07-1-Linux-x86_64.sh
確保輸出的校驗(yàn)和與預(yù)期的MD5校驗(yàn)和(b35af0fae8e8667609722e2c0d196f1d)一致。
檢查文件系統(tǒng)空間:確保在解壓縮過程中有足夠的磁盤空間。檢查您的文件系統(tǒng)是否有足夠的可用空間來解壓縮Anaconda3。
使用其他解壓縮工具:嘗試使用其他解壓縮工具(如
tar
命令)來解壓縮Anaconda3安裝文件。您可以使用以下命令進(jìn)行解壓縮:tar -xvf Anaconda3-2023.07-1-Linux-x86_64.sh
這將使用
tar
命令解壓縮安裝文件。如果嘗試上述方法后仍然遇到問題,請確保您的系統(tǒng)環(huán)境和安裝步驟正確,并考慮查閱Anaconda官方文檔或社區(qū)支持以獲取更進(jìn)一步的幫助。
現(xiàn)在嘗試下載到Windows(方法2)
注意,首先需要解決上述歷史遺留問題……需要?jiǎng)h除文件夾
rm -rf /home/qomolangma/anaconda3
2.下載到Windows
Free Download | Anacondahttps://www.anaconda.com/download#downloads
? ?安裝:/mnt+你下載的位置(注意磁盤d不能寫成D)
bash /mnt/d/LenovoSoftstore/Anaconda3-2023.07-1-Linux-x86_64.sh
?如上圖所示,再次輸入yes(官網(wǎng)建議)j進(jìn)行初始化,否則需要手動添加環(huán)境變量
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
no change /home/qomolangma/anaconda3/condabin/conda
no change /home/qomolangma/anaconda3/bin/conda
no change /home/qomolangma/anaconda3/bin/conda-env
no change /home/qomolangma/anaconda3/bin/activate
no change /home/qomolangma/anaconda3/bin/deactivate
no change /home/qomolangma/anaconda3/etc/profile.d/conda.sh
no change /home/qomolangma/anaconda3/etc/fish/conf.d/conda.fish
no change /home/qomolangma/anaconda3/shell/condabin/Conda.psm1
no change /home/qomolangma/anaconda3/shell/condabin/conda-hook.ps1
no change /home/qomolangma/anaconda3/lib/python3.11/site-packages/xontrib/conda.xsh
no change /home/qomolangma/anaconda3/etc/profile.d/conda.csh
modified /home/qomolangma/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!
選yes后,啟動虛擬機(jī),會出現(xiàn)當(dāng)前環(huán)境(base)字樣
換源
conda config --set show_channel_urls yes
可以用記事本打開,增加以下內(nèi)容保存并退出,修改為清華源
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
三、conda常用命令
查看當(dāng)前python版本
python3 --version
查看配置信息
conda info
(未換源)
查看環(huán)境列表
conda env list
激活環(huán)境
conda activate base
退出環(huán)境
conda deactivate
?
conda使用文檔
管理 conda — conda 23.5.3.dev85 文檔https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-conda.html
亦可參照前文:
conda命令大全(create/info/init/install/list/package/remove/rename/run/search/update/notices)_conda create install_m0_63834988的博客-CSDN博客https://blog.csdn.net/m0_63834988/article/details/128780777?spm=1001.2014.3001.5501
(好久之前寫的,寫的很爛,如蒙不棄,點(diǎn)開看看,增加點(diǎn)兒閱讀量)
四、Windows上Pycharm使用WSL的虛擬環(huán)境
- 新建項(xiàng)目,選擇先前配置的解釋器
- 自動檢測Linux
- 選擇conda環(huán)境——base(或其它環(huán)境)
- ?創(chuàng)建
- 測試代碼
五、遠(yuǎn)程開發(fā)——使用 SSH 在另一臺主機(jī)上WSL 實(shí)例
如圖所示:
?
點(diǎn)擊安裝選項(xiàng)可修改安裝位置
點(diǎn)擊下載IDE并連接
安裝
文章來源:http://www.zghlxwxcb.cn/news/detail-713244.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-713244.html
到了這里,關(guān)于【2023最新版】Windows11:WSL(Ubuntu22.04)安裝Anaconda(換源、各種報(bào)錯(cuò)及解決方案)+連接Pycharm進(jìn)行遠(yuǎn)程開發(fā)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!