這篇文章主要講解了如何解決Win10用vscode打開anaconda環境中的python出錯問題,內容清晰明了,對此有興趣的小伙伴可以學習一下,相信大家閱讀完之后會有幫助。
環境變量配置
首先需要將anaconda的路徑配置進環境變量中,我是用戶變量和系統變量都配置了。我的anaconda安裝在D:\Anaconda,于是環境變量加入:D:\Anaconda D:\Anaconda\Scripts D:\Anaconda\Library\bin這三個。
不支持powershell
環境變量配置完成后,vscode運行hello.py文件報了下面的錯誤:
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
有點煩…
打開powershell,輸入conda activate,沒有反映…
但是打開cmd,輸入conda activate則順利激活了base環境,此時就可以使用環境中的python了?。?!
所以vscode中,在terminal輸入cmd,手動激活環境再打開python即可。?;蛘咧苯忧袚Q默認terminal為cmd,這樣每次運行python文件都不會出現問題了。
看完上述內容,是不是對如何解決Win10用vscode打開anaconda環境中的python出錯問題有進一步的了解,如果還想學習更多內容,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。