网络编程
位置:首页>> 网络编程>> Python编程>> Win10用vscode打开anaconda环境中的python出错问题的解决

Win10用vscode打开anaconda环境中的python出错问题的解决

作者:一只用R的浣熊  发布时间:2023-04-21 09:21:21 

标签: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即可。。或者直接切换默认terminal为cmd,这样每次运行python文件都不会出现问题了。

来源:https://blog.csdn.net/weixin_44597588/article/details/106305501

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com