如何在 Textmate 中使用 Python 3.1.2?
TextMate 1.5.9似乎使用Python 2.6.1。如何将其配置为使用 3.1?我已经安装了 3.1 软件包,并且可以使用 IDLE 进行交互式会话,但我现在想使用 TextMate。我已经看过指导您定义项目变量(TM_PYTHON:解释器路径)的帖子。我尝试了这个,但是当我使用 Cmd+r 在 Textmate 中运行脚本时,我仍然看到 Python 2.6.1 作为版本号(上/右)。连终端都用2.7!
帮助!
TextMate 1.5.9 seems to use Python 2.6.1. How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I want to use TextMate now. I've already seen the post that directs you to define a project variable (TM_PYTHON : interpreter path). I tried this, but when i use Cmd+r to run a script in Textmate I still see Python 2.6.1 as the version number (top/right). Even the Terminal uses 2.7!
Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您指的是这篇文章。它应该可以工作,但请确保您使用安装的 Python 3.1 的正确路径。检查:
如果您使用了 python.org 3.1 安装程序,它应该可以在
/usr/local/bin/python3
中找到。其他方法可能会有所不同,例如,MacPorts python3.1 通常位于/opt/local/bin/python3
。更新:既然您指出它仍然对您不起作用,我的猜测是我们正在使用不同版本的 TextMate 的 Python 包。使用 TextMate Bundle Editor(菜单项
Bundles -> Bundle Editor -> Show Bundle Editor
),然后选择 Python 包的Run Script
命令,我看到以下命令片段:看看有没有一样的。如果没有,您应该考虑更新 TextMate 和/或捆绑包。
GetBundle
捆绑包可以轻松地使捆绑包保持最新,如此处。I assume you are referring to this post. It should work but make sure you are using the right path to the Python 3.1 you installed. Check with:
If you used the python.org 3.1 installer, it should be available at
/usr/local/bin/python3
. Other methods may vary, for instance, the MacPorts python3.1 would normally be at/opt/local/bin/python3
.UPDATE: Since you indicate that it still doesn't work for you, my guess is that we are using different versions of TextMate's Python bundle. Using the TextMate Bundle Editor (menu item
Bundles -> Bundle Editor -> Show Bundle Editor
) then selecting the Python bundle'sRun Script
command, I see the following command snippet:Check and see if you have the same. If not, you should consider updating TextMate and/or the bundle. The
GetBundle
bundle makes it easy to keep bundles up-to-date as described here.从你的脚本中去掉这个正常的 she bang 然后运行它,你就会在 textmates 窗口中显示版本 3。默认的 shebang 会覆盖该变量并将您带回 osx 默认版本 2.6.1。一切都有点奇怪......
Take away this normal she bang from your script then run it you will then have version 3 show up in textmates window. The default shebang overrides the variable and sends you back to osx default version 2.6.1. It is all a bit weird....