使用Window內建之Powershell
一般Windows
使用者使用conda通常應該是在內建的Powershell
進行操作,但是在部份的電腦中常常遇到無法有效開啟conda
的環境問題。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
首先使用conda
指令,發現powershell
可以成功的呼叫出conda
相關說明與指令,但是卻無法切換環境,powershell也無法在前面出現(base)
。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
使用者原則問題
重點在於powershell
的 .ps1 檔案,這個是PowerShell寫的指令碼文字,你可以在記事本中寫一段PowerShell程式碼,然後將其儲存為“xxx.ps1”ps1檔案是PowerShell寫好的指令碼檔案。在Windows系統中,預設情況下是不允許執行.ps1檔案的。
這時候會發現執行了conda init powershell
之後再打開powershell
後會發現類似以下的訊息:
解決方式
使用 Powershell ISE
進行原則修改,利用系統管理員的身份打開。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
並在頁面中輸入以下指令:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
此時電腦預設應該是Restricted
,這時候我們要輸入修改的指令
最後在將程式關掉,Powershell以系統管理員身份重新開啟,並重新輸入conda init powershell
指令,使其寫入指令檔後再次關閉Powershell
,重新開啟後,應該就能看到前方寫著(base)
的環境狀態了,這時候也能透過conda activate [name]
進行環境上的切換了。