python多版本工具miniconda的配置優(yōu)化實(shí)現(xiàn)
conda比較重,所以我用了miniconda,切換python版本也足夠方便。
安裝miniconda的步驟請(qǐng)自行搜索。
1.添加path環(huán)境變量
如下三個(gè)路徑添加到path環(huán)境中,前綴按實(shí)際情況修改
miniconda安裝目錄 miniconda安裝目錄\Scripts miniconda安裝目錄\bin
2.修改為國內(nèi)源
家目錄創(chuàng)建C:\Users\用戶名\.condarc
文件,內(nèi)容如下:
channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro - 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/cloud/bioconda - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/simpleitk show_channel_urls: true ssl_verify: false
3.常用命令
conda activate 環(huán)境 #切換到對(duì)應(yīng)的環(huán)境 conda env list #列出有哪些環(huán)境 conda remove -n 環(huán)境 --all #刪除一個(gè)環(huán)境 conda create -n 環(huán)境名 python=3.8 #創(chuàng)建新的環(huán)境,并指定python版本 conda init powershell #安裝完初始化的命令
問題點(diǎn):
現(xiàn)在這樣確實(shí)可以用了,但是會(huì)發(fā)現(xiàn)啟動(dòng)powershell會(huì)變的很慢,原因就是conda啟動(dòng)的很慢。
這里介紹一下關(guān)閉的方法。
在C:\Users\用戶名\Documents\WindowsPowerShell文件夾下有,profile.ps1文件,把這個(gè)文件剪切到其它地方。
文件內(nèi)容,參考如下:
profile.ps1
#region conda initialize # !! Contents within this block are managed by 'conda init' !! If (Test-Path "miniconda安裝目錄\Scripts\conda.exe") { (& "miniconda安裝目錄\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression } #endregion
此時(shí)powershell的終端已經(jīng)不顯示用的conda的那個(gè)環(huán)境(效果如下),但是啟動(dòng)速度超快。
PS C:\Users\young>
想要用conda時(shí)要怎么辦呢?
1.打開默認(rèn)的profile文件
notepad $PROFILE
說明: powershell中輸入這個(gè)命令,會(huì)打印出profile文件的位置
$PROFILE
2.在文件里新建一個(gè)函數(shù)pp,當(dāng)需要conda時(shí),powershell輸入pp等待加載一兩秒即可。函數(shù)內(nèi)容如下,函數(shù)體的內(nèi)容就是上面profile.ps1的內(nèi)容
function pp{ If (Test-Path "miniconda安裝目錄\Scripts\conda.exe") { (& "miniconda安裝目錄\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression } }
3.演示效果
PS C:\Users\young> pp (base) PS C:\Users\young>
到此這篇關(guān)于python多版本工具miniconda的配置優(yōu)化實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)python miniconda配置優(yōu)化內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決python 兩個(gè)時(shí)間戳相減出現(xiàn)結(jié)果錯(cuò)誤的問題
這篇文章主要介紹了解決python 兩個(gè)時(shí)間戳相減出現(xiàn)結(jié)果錯(cuò)誤的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2021-03-03matplotlib基礎(chǔ)繪圖命令之errorbar的使用
這篇文章主要介紹了matplotlib基礎(chǔ)繪圖命令之errorbar的使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-08-08使用Django實(shí)現(xiàn)文章與多個(gè)標(biāo)簽關(guān)聯(lián)的示例詳解
在構(gòu)建一個(gè)博客或內(nèi)容管理系統(tǒng)時(shí),經(jīng)常需要實(shí)現(xiàn)文章與標(biāo)簽的關(guān)聯(lián),在 Django 中,我們可以利用 ManyToManyField 來實(shí)現(xiàn)文章與標(biāo)簽的多對(duì)多關(guān)系,在本文中,我們將詳細(xì)探討如何使用 Django 模型實(shí)現(xiàn)文章與多個(gè)標(biāo)簽的關(guān)聯(lián),需要的朋友可以參考下2023-11-11python實(shí)現(xiàn)自動(dòng)化之文件合并
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)自動(dòng)化文件合并,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-08-08python讀取mat文件生成h5文件的實(shí)現(xiàn)
這篇文章主要介紹了python讀取mat文件生成h5文件的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-07-07Python Requests爬蟲之求取關(guān)鍵詞頁面詳解
這篇文章主要為大家詳細(xì)介紹了Python Requests爬蟲之求取關(guān)鍵詞頁面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助2022-02-02Python將圖片轉(zhuǎn)為漫畫風(fēng)格的示例
本文主要介紹了Python將圖片轉(zhuǎn)為漫畫風(fēng)格的示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-04-04Python解決ModuleNotFoundError: No module named&
ModuleNotFoundError: No module named 'PIL'是一個(gè)常見的Python錯(cuò)誤,通常出現(xiàn)在使用Pillow庫時(shí),Pillow是Python中用于圖像處理的一個(gè)庫,其前身是PIL,本文介紹了Python解決ModuleNotFoundError: No module named 'PIL'的問題,需要的朋友可以參考下2024-09-09