我已经在Ubuntu 15.04上为Emacs Python安装了flycheck。
然而,在使用该工具时,它会报告假阳性,例如
我知道这是Python 3的语法,并且语法错误是由于flycheck设置为Python 2造成的。 如何为Python 3设置flycheck? 在Github上的文档中,它没有提到是否支持Python 2或3(只有Python)。
此外,如果可能的话,请给我一个提示,为什么elpa工具没有为基本的Python类型提供建议。
我的init.el文件在这里:
然而,在使用该工具时,它会报告假阳性,例如
print(item, end=' ')
由于end
是错误的语法。我知道这是Python 3的语法,并且语法错误是由于flycheck设置为Python 2造成的。 如何为Python 3设置flycheck? 在Github上的文档中,它没有提到是否支持Python 2或3(只有Python)。
此外,如果可能的话,请给我一个提示,为什么elpa工具没有为基本的Python类型提供建议。
我的init.el文件在这里:
;; init.el --- Emacs configuration
;; INSTALL PACKAGES
;; -------------------------------------
(require 'package)
;; Primary Emacs repository is MELPA
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar myPackages
'(better-defaults
elpy ;; Emacs Lisp Python Environment
flycheck ;; flycheck Python syntax-checking
material-theme))
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;; BASIC CUSTOMIZATION
;; -------------------------------------
(setq inhibit-startup-message t) ;; hide startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally
(global-flycheck-mode) ;; enable flycheck globally
;; PYTHON CONFIGURATION
;; -------------------------------------
(elpy-enable) ;; enable elpy
;; use flycheck, not flymake with elpy
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-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.
'(python-shell-interpreter "python3"))
(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.
)
;; init.el ends here
await
和async
关键字以及print
函数相同的问题。 - user9903