【问题标题】:Sublimetext suddenly won't build .py script (Anaconda3). KeyError: 'conda_environment'Sublimetext 突然不会构建 .py 脚本(Anaconda3)。 KeyError:'conda_environment'
【发布时间】:2021-10-05 15:31:20
【问题描述】:

已解决。显然我以某种方式停用了我的 Conda 环境。在 Sublime 控制台中输入 Conda: Activate Environment 修复了它。

我正在使用 Anaconda3 运行在我的工作场所开发的脚本。我已经设置了 SublimeText 来查看/编辑脚本并使用 build 命令运行它们。到今天为止,我已经可以正常运行脚本了。

然而,今天有些命令没有用白框括起来,我收到一条错误命令,试图构建脚本。Here's a screenshot showing the markings and error message

我第一次重新启动计算机无济于事。然后我卸载并重新安装了 Conda 和 Anaconda 的软件包,但也未能修复它。谷歌搜索“sublime conda not building”给了我结果,这些结果涉及构建脚本时的错误消息,而不是无法完全构建。我也找不到与我的特定错误消息匹配的内容。

有什么见解吗?如果不是很明显,我是 python & sublime 的新手。谢谢。

编辑:白盒子现在不见了。更重要的是,显然它们与 linting 有关,并且(可能)与主要关注的未构建脚本无关。

编辑2: 插件网址CondaAnaconda

我找不到 conda.sublime-build,但我发现 conda.sublime-settings 我认为是同一件事。如果没有,请让我知道在哪里看。 (这是在用户包下)。这些设置粘贴在下面。

// Default Windows settings for sublime-text-conda:
{
    // executable is the path to anaconda's python
    // this python executable is used in order to find conda
    "executable": "C:\\Users\\26036\\Anaconda3\\python.exe",

    // Directory in which the conda envs are stored
    // Default location is the user's home directory
    "environment_directory": "C:\\Users\\26036\\Anaconda3\\envs\\",
    
    // System architecture for Python installation
    // options: 32 or 64 bit
    "architecture": "64",

    // configuration is the path to conda's configuration file
    "configuration": "~\\.condarc",

    // when true, the scripts will be run through the shell
    // If your code has a GUI (e.g. a matplotlib plot),
    // this needs to be true, otherwise Windows suppresses it.
    "run_through_shell": false,

    // when true, the script execution will be handed over to
    // the pythonw executable, instead of python
    "use_pythonw": false,

    // open repl in second row tab below current file,
    // closing any existing tabs in that area
    // assumes files are kept in group 0 (typical)
    "repl_open_row": false,

    // when opening a repl using repl_open_row, close any
    // existing conda repls in the second row first
    "repl_row_close_existing": false,

    // save the current file (if dirty) when opening repl
    "repl_save_dirty": true,

    // syntax highlighting for Open REPL command
    // choice between 'python' and 'plaintext'
    "repl_syntax": "python"
}

EDIT3:我同时安装了 Conda 和 Anaconda3 软件包。当它工作时,我选择了 Conda 作为我的构建系统。我可以确定环境已激活,因为我能够事先运行脚本,但也许环境已停用?

【问题讨论】:

  • edit您的问题并发布您的.sublime-build构建系统文件的全部内容。还请提供您正在使用的插件的 URL。
  • 另外,您确定您已经激活了正确的 conda 环境,并且您使用的是 Conda 构建系统而不是 Anaconda 系统吗?
  • 嗨,MattDMo。我已经对帖子进行了编辑以解决您的 cmets。感谢您的帮助。
  • 等等。我刚刚在 Sublime 控制台中尝试了“Conda:激活环境”,现在它又可以工作了!!非常感谢,非常感谢!我不知道它是如何被停用的。就像我说的,它以前工作过。

标签: sublimetext anaconda3


【解决方案1】:

原来我的 Conda 环境不知何故变得不活跃。在 Sublime 控制台中键入“Conda:激活环境”修复它。感谢 MattDMo 建议我检查一下。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-25
    • 2018-07-30
    相关资源
    最近更新 更多