在Aptana Studio中本地运行Python 3 [英] Running Python Locally In Aptana Studio 3

查看:2205
本文介绍了在Aptana Studio中本地运行Python 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Mac OS X El Capitan(版本10.11.6)上安装了Python 3.5.2。我(想)我正确配置Aptana Studio 3,以便它指向Python 3.5,当它运行任何Python代码。但我收到错误消息,甚至为什么我试图运行简单的命令。



如果您查看以下屏幕截图:





您会注意到(4 + 8)打印12,但我在打印命令的左边得到一个红色的X(悬停后显示未定义的变量:打印)。我也得到Traceback消息和TypeErrors。当我尝试更高级的东西,比如创建一个函数并运行测试时,也是如此:









如果Aptana正确地指向Python 3,我不应该得到这些错误消息,对吧?你可以在屏幕截图中看到,Python 3.5与我用来运行代码的test.py文件在同一个文件夹中。我按照



我不明白为什么3.5 isn显示?如果我选择Python解释器(Python 1)下的第二个选项,它现在在系统库中显示Python 3,但是当我点击高级自动配置时,它仍然只提供了版本2.6和2.7。



解决方案

我得到错误消息,因为Aptana Studio(以及每个其他IDE)不支持testEqual。 TestEqual只能在Active Code中使用,我们正在使用(在线)我目前注册的类。删除后:

  from test import testEqual 


$ b b

  testEqual(

,然后打印sum_evens函数

  print(sum_evens([2,3,4]))
/ pre>

控制台打印正确答案时没有任何错误消息。


I recently installed Python 3.5.2 on Mac OS X El Capitan (Version 10.11.6). I (thought) I configured Aptana Studio 3 correctly so that it points at Python 3.5 when it runs any Python code. But I'm getting error messages even why I try to run simple commands.

If you take a look at the following screenshots:

You'll notice that printing(4+8) does print 12, but I get a red X to the left of the print command (which after hovering reveals "undefined variable: print"). I also get Traceback messages and TypeErrors. The same goes for when I try something more advanced, like creating a function and running tests:

I shouldn't be getting these error messages if Aptana is pointed at Python 3 correctly, right? You can see in the screenshots that Python 3.5 is in the same folder as the test.py file I'm using to run the code. I had followed this youtube tutorial to configure Python Interpreter in Aptana (she starts this around 1:30). Any help is greatly appreciated!

EDIT: Following these instructions on VectorWorks, I go to Preferences > PyDev > Interpreters > Python Interpreter and click on Advanced Auto-Config. The options that show up only include Python versions 2.6 and 2.7.

I don't understand why 3.5 isn't showing up? If I choose the second option under Python Interpreters (Python 1), it now displays Python 3 in the system library, but again when I click advanced auto config, it still only provides me with versions 2.6 and 2.7.

解决方案

I was getting error messages because Aptana Studio (along with every other IDE) doesn't support testEqual. TestEqual only works in Active Code, the text editor that we're using (online) for the class I'm currently enrolled in. After removing:

from test import testEqual

and

testEqual( 

and then printing the sum_evens function:

print(sum_evens([2,3,4]))

The console prints the correct answer without any error messages.

这篇关于在Aptana Studio中本地运行Python 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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