首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Emacs shell无法识别python命令

Emacs shell无法识别python命令
EN

Stack Overflow用户
提问于 2021-01-23 14:26:36
回答 1查看 65关注 0票数 1

我一直在尝试用emacs编写一些python代码,但是emacs的shell不能编译我的代码。它一直显示此错误:'python‘未被识别为内部或外部命令、可操作程序或批处理文件。’我已经将Python路径添加到系统变量中,所以它可以在命令提示符下正常运行python,但不能在emacs shell中正常运行这是我的init.dl文件

代码语言:javascript
复制
(require 'package)

;; Adds the Melpa archive to the list of available repositories
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)

;; Initializes the package infrastructure
(package-initialize)

;; If there are no archived package contents, refresh them
(when (not package-archive-contents)
  (package-refresh-contents))

;; Installs packages
;;
;; myPackages contains a list of package names
(defvar myPackages
  '(better-defaults    ;; Set up some better Emacs defaults
    elpy               ;;Emacs lisp python environment
    material-theme                  ;; Theme
    )
  )

;; Scans the list in myPackages
;; If the package listed is not already installed, install it
(mapc #'(lambda (package)
          (unless (package-installed-p package)
            (package-install package)))
      myPackages)

;; ===================================
;; Basic Customization
;; ===================================

;;(setq inhibit-startup-message t)    ;; Hide the startup message
;;(load-theme 'material t)            ;; Load material theme
(global-linum-mode t)               ;; Enable line numbers globally

;; ====================================
;; Development Setup
;; ====================================
;; Enable elpy
(elpy-enable)
EN

回答 1

Stack Overflow用户

发布于 2021-02-10 05:02:20

这个包将帮助您:exec-path-from-shell

您可以通过Emacs内置的包管理器Melpa安装它,方法是运行以下命令

代码语言:javascript
复制
M-x package-install RET exec-path-from-shell RET

然后,将以下行放入您的init file并重新启动Emacs:

代码语言:javascript
复制
(exec-path-from-shell-initialize)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65856385

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档