在emacs run-python中运行不同的python版本 [英] running a different python version in emacs run-python

查看:117
本文介绍了在emacs run-python中运行不同的python版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行`M-x run-python'时,它会打开一个解释器,但它是python 2.7.

When I do `M-x run-python' it opens an interpreter but it is python 2.7.

我希望使用命令"M-x run-python"将其打开,就像在anaconda3安装中一样.我想这样做,因为我的软件包目前都无法导入.因此,我遵循了此答案" 的建议,并将以下内容添加到了我的/.emacs.d/init.el文件中.

I would like the command `M-x run-python' to open it as is in my anaconda3 installation. I want to do this, as none of my packages are importable currently. So I followed advice from "this answer" and added the following to my /.emacs.d/init.el file.

$ (setq python-python-command "/home/eghx/anaconda3/bin/python")

它不起作用.我最终只打开python 2.7

It doesn't work. I only end up opening python 2.7

此外,anaconda的python可与spyder(IDE)一起使用,可在我的终端以及其他所有地方使用,默认情况下与emacs无关.

Furthermore, anaconda's python works with spyder (IDE), works in my terminal and everywhere else except by default with emacs.

您可以说我是菜鸟,非常感谢您的帮助.谢谢

As you can tell I am a noob and would greatly appreciate any help. Thanks

Ubuntu 16最近安装,Emacs 27.0.5,Anaconda 3

Ubuntu 16 recent install, Emacs 27.0.5, Anaconda 3

推荐答案

在外壳中检查Python3或IPython3的路径:

check the path to Python3 or better to IPython3 in the shell:

$ which python3

将路径添加到初始化文件:

add the path to init file:

(setq python-shell-interpreter "/path/to/ipython3")

这篇关于在emacs run-python中运行不同的python版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆