0

emacs24をWindowsにインストールしC:\Program Files(x64)、python2.7をC:\Python27

私はPythonモードをインストールして、emacsからインタープリターにコマンドを送信しようとしました。私のinit.elファイルUsers/myname/.emacs.d

(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\Python27\python.exe")

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

私はPythonモードファイルを次の場所に置きました:C:\Users\myname\.emacs.d\python-mode.el-6.1.1

メニューでPyShell>DefaultIntepreterオプションを選択すると、インタラクティブなPythonセッションをバッファーに形成できますが、.pyファイルを開いて、メニューPyExec> Execute Statementに移動するなどしてhellowワールドを実行しようとすると、エラーが発生します。この性質の:

Opening output file: no such file or directory, c:/Users/Ben/AppData/Local/Temp/C-/Python27/python.exe-705218Y.py

Pythonコードを編集して、このエラーなしで別のバッファーのPythonインタープリターに行を送信できるように設定するにはどうすればよいですか?

4

1 に答える 1

3

と を使用setqcustom-set-variablesて を設定しpy-shell-nameます。私の記憶が正しければ、それ以前にcustom-set-variables使用すると動作しません。setqまた、文字列リテラルで記述する場合はバックスラッシュをエスケープする必要があります。次のいずれかを使用すると、問題が解決するはずです。

を使用するにはsetq、バックスラッシュを修正します。

(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\\Python27\\python.exe")

を使用するにはcustom-set-variables、単に削除しsetqます:

(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
于 2013-03-08T05:37:17.573 に答える