简体   繁体   English

emacs jedi不起作用

[英]emacs jedi doesn't work

I'm trying to find the solution for days, but I didn't get it yet. 我试图找到解决方案好几天,但我还没有得到它。 So, if you guys could help me I'd appreciate it. 所以,如果你们能帮助我,我会很感激。 I've been using emacs to code in Python, I'm a very beginner using emacs, so, I decided to install the autocomplete Jedi feature. 我一直在使用emacs来编写Python代码,我是一个非常初学者使用emacs,因此,我决定安装自动完成Jedi功能。 In some tutorials I've found they ask me to add this line in the ./emacs file (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup) 在一些教程中,我发现他们要求我在./emacs文件中添加这一行(add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup) hook'python (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup) hook'auto (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup) hook'python (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook 'jedi:ac-setup)

I add those lines in the file and restart Emacs, however when I open some .py file they report me some errors. 我在文件中添加这些行并重新启动Emacs,但是当我打开一些.py文件时,他们会报告一些错误。 ps. PS。 I've installed Jedi through the Melpa package! 我通过Melpa包安装了Jedi! ps. PS。 I'm using Ubuntu 12.04 我正在使用Ubuntu 12.04

Thanks in advance! 提前致谢!

A good idea when asking a question when it relates to Emacs, is specifying what operating system you are using as the solution might be OSX/Linux centric vs Windows. 在询问与Emacs相关的问题时,一个好主意是指定您正在使用的操作系统,因为解决方案可能是以OSX / Linux为中心而不是Windows。 As well you might want to post specific error messages. 您也可以发布特定的错误消息。

You have to enter those lines in your emacs configuration file, which on Linux/OSX would be in ~/.emacs . 您必须在emacs配置文件中输入这些行,这些行在Linux / OSX上将位于~/.emacs The tilde meaning your home folder. 代字号意味着您的主文件夹。 You can also put your emacs configuration in ~/.emacs.d/init.el . 您还可以将emacs配置放在~/.emacs.d/init.el

Without your question being more specific, all I can say is that I use the el-get package manager to install jedi. 如果没有您的问题更具体,我可以说的是我使用el-get软件包管理器来安装jedi。 And use the following in my configuration to get things working. 并在我的配置中使用以下内容来使事情正常运行。

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:setup-keys t)                     
(setq jedi:complete-on-dot t) 

Also make sure you have your PYTHONPATH environment variable setup correctly. 还要确保正确设置PYTHONPATH环境变量。 You would put something like export $PYTHONPATH=/path/to/python/libraries in your ~/.bashrc . 您可以在~/.bashrc类似export $PYTHONPATH=/path/to/python/libraries This would only be necessary if you installed your python modules in a non-standard place. 只有在非标准位置安装python模块时才需要这样做。

See for instance, Emacs deferred errors for similar errors to what you are getting. 例如,请参阅Emacs将类似错误的错误延迟到您获得的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM