简体   繁体   English

Sublime文本3仍然使用python 2.7。 [我已经卸载它并安装了python 3.3]

[英]Sublime text 3 still using python 2.7. [ I have uninstalled it and installed python 3.3 ]

Since, we need python 3.3 to install package control in sublime text 3. So I have uninstalled python 2.7 which was there in my PC and installed python 3.3. 因为,我们需要python 3.3在sublime文本3中安装软件包控件 。所以我已经卸载了python 2.7,它在我的电脑上并安装了python 3.3。 I am not getting any error in python terminal for importing the libraries required to install sublime text package control but when I install it through sublime text ( ctrl + ` ), I get the same errors which I was getting with python 2.7. 我没有在python终端中输入任何错误来导入安装sublime文本包控件所需的库,但是当我通过sublime文本( ctrl + ` )安装它时,我得到了与python 2.7相同的错误。

I want to know how do I make default python version for sublime text as 3.3 instead of 2.7. 我想知道如何将sublime文本的默认python版本设为3.3而不是2.7。

PS : I have restarted my sublime text as well as my PC. PS:我已经重新启动了我的崇高文本和我的电脑。

Sublime Text comes with its own Python version embedded inside. Sublime Text内置了自己的Python版本。 It is Python 2.7 for Sublime 2 and Python 3.3 for Sublime 3. This Python installation is used to run Sublime plug-ins; 它是用于Sublime 2的Python 2.7和用于Sublime 3的Python 3.3。这个Python安装用于运行Sublime插件; you also can access the console via the shortcut Ctrl + ` . 您也可以通过快捷键Ctrl + `访问控制台。

On top of that, you can optionally install (any) Python version on your PC and use it yourself to run your Python programs. 最重要的是,您可以选择在您的PC上安装(任何)Python版本并自己使用它来运行您的Python程序。 Sublime doesn't need it for anything, but if it's there, then it can help you to run the programs directly from editor with the "build system" feature. Sublime不需要任何东西,但如果它存在,那么它可以帮助您直接从编辑器使用“构建系统”功能运行程序。

Your Python installation doesn't have anything to do with the version that Sublime Text uses internally and doesn't have to match it. 您的Python安装与Sublime Text内部使用的版本没有任何关系,也不必与之匹配。

:| :| You can very well use Python 2.7 to install Package control in ST3. 您可以很好地使用Python 2.7在ST3中安装Package控件。 I'm doing so. 我这样做了。 You might have messed up a lot more things than just ST3 by removing Python 2.7. 通过删除Python 2.7,你可能搞砸了比ST3更多的东西。 For now, You can create a file called Python.sublime-build inside Packages/Python/ of your ST3 directory and write this - 现在,你可以在你的ST3目录的Packages/Python/中创建一个名为Python.sublime-build的文件并写下来 -

{
    'cmd': ['/usr/bin/python3', '-u', '$file'],
    'file_regex': '^[ ]*File "(…*?)", line ([0-9]*)',
    'selector': 'source.python'
}

Should work. 应该管用。

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

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