簡體   English   中英

Spacemacs將python shell設置為Anaconda3路徑

[英]Spacemacs set python shell to Anaconda3 path

我已經開始使用Spacemacs編輯python文件以及使用org-mode,但是現在我想從Spacemacs運行python而不是運行Anaconda Prompt。

我已經用SPC fed .spacemacs寫在.spacemacs文件中:

(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")
  )

但是,當我嘗試使用Cc Cp運行腳本時,出現以下錯誤: Searching for program: No such file or directory, python

我對Windows上的Spacemacs並不完全熟悉,但是這是我的努力...

命令行不是shell

請注意,anaconda提示符不是shell,它是anaconda的命令提示符界面( 請參見此處 )。

Windows使用cmd。 Spacemacs,Unix和Python使用shell ,它們是一個完全不同的接口。

歡迎來到Spacemacs

您在該變量中輸入的內容不應是文件路徑。 它應該是程序的名稱。 Emacs列出了可執行文件的存儲位置。 此變量稱為exec-path 是設置方法。

我建議不要修改它,而要查看它

(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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM