如何在Anaconda Env中启动Visual Studio代码

时间:2018-05-15 23:25:31

标签: python python-3.x anaconda

我在Windows 10 PC上的visual studio代码中运行python程序时遇到了麻烦。

当我从终端开始一个python会话并说import cv2时我没有错误:

enter image description here

当我通过命令提示符并从env中启动VSCode时,我得到了ModuleNotFoundError

enter image description here

Traceback (most recent call last): File "gui.py", line 3, in <module> import cv2 ModuleNotFoundError: No module named 'cv2'

当我尝试在环境中以python gui.py运行程序时,我的命令提示符崩溃并显示错误消息:

enter image description here

我不知道怎么问这个问题,除了想知道是否有办法在python环境中启动我的IDE,以便它可以找到所有本地软件包。

1 个答案:

答案 0 :(得分:0)

  1. 确保已在系统中安装 Visual Studio代码
  2. 确保已配置环境变量。 (请参见下图以供参考) enter image description here

  3. 转到您的 Anaconda命令提示符,然后键入 x[i−j] (请参见下图以供参考) enter image description here

  4. 要从Anaconda / Window命令提示符下启动VS代码,请输入 0≤i−j≤n 。 (请参见下图)

enter image description here