问题:cudatoolkit cudnn 通过conda 虚拟环境安装,先前已经使用virtualenv安装tf,需要在conda虚拟环境中启动外部python虚拟环境
思路:conda prompt
即将 [虚拟环境位置] 以参数形式传入 [activate.bat]
VSOCDE中的设置
添加以下语句
{
"terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe", #选用cmd作为命令行窗口
"terminal.integrated.shellArgs.windows": [
"/k",
"C:\Users\PC\miniconda3\scripts\activate.bat C:\Users\PC\miniconda3\envs\tfcuda101" #此处修改为你conda虚拟环境文件夹位置
],
"python.pythonPath": "c:\Users\PC\tensorflow2\scripts\python.exe", #选择virtualenv下的python路径
}
搞定,下次进入相关项目自动加载conda环境与virtualenv环境
验证成功加载cuda库:
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
到此这篇关于在vscode中启动conda虚拟环境的思路详解的文章就介绍到这了,更多相关vscode中启动conda虚拟环境内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!



