【问题标题】:Spacemacs set python shell to Anaconda3 pathSpacemacs 将 python shell 设置为 Anaconda3 路径
【发布时间】:2017-06-30 01:24:34
【问题描述】:

我已经开始使用 Spacemacs 来编辑 python 文件并使用 org-mode,但现在我想从 Spacemacs 运行 python 而不是运行 Anaconda Prompt。

我已经在.spacemacs 文件中用SPC f e d 写了这个:

(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
  (setq python-shell-interpreter "C:/Users/Mahesvara/Documents/Personal_Documents/Programs/Anaconda3/python.exe")
  )

但是当我尝试使用C-c C-p 运行脚本时,会出现以下错误:Searching for program: No such file or directory, python

【问题讨论】:

    标签: python emacs anaconda spacemacs


    【解决方案1】:

    我对 Windows 上的 Spacemacs 并不完全熟悉,但这是我的尝试......

    命令行不是shell

    注意 anaconda 提示符不是 shell,它是 anaconda (see here) 的命令提示符界面。

    Windows 使用 cmd。 Spacemacs、Unix 和 Python 使用 shells,并且是完全不同的界面。

    欢迎来到 Spacemacs

    您放入该变量的内容不应是文件路径。它应该是一个程序的名称。 Emacs 有一个存储可执行文件的位置列表。 此变量称为exec-path。 Here是怎么设置的。

    我建议不要修改它,而是查看它

    (print exec-path)
    

    然后需要在这些路径之一(即 python、ipython 等)中有一个 python shell。

    经验丰富的 Windows 开发人员可能不同意这一点。但是安装一些 Babun/Cygwin shell 来安装 python 可能会有所帮助。特别是如果您使用的是 Spacemacs。这将允许您在更适合 Spacemacs 的 Unix-y 环境中运行。只要确保主目录匹配。

    一旦您在exec-path 之一中安装了python shell 程序, 您应该能够:

    (setq python-shell-interpreter "python")
    

    将 python 更改为您选择的任何 python shell。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-07
      • 2016-12-01
      • 2015-04-09
      相关资源
      最近更新 更多