Aptana 3 未解决的导入 - Python
我试图在 Aptana 3 的 Python 项目中导入 pycassa 库,但在“import pycassa”行中它显示下一个错误:“未解析的导入:pycassa”。我通过简单安装安装了 pycassa,如果我在 python shell 中运行“import pycassa”,它运行时不会出现错误。如果我运行 Aptana 项目也没有错误,但错误标记仍然存在。为什么?
对不起我的英语。
I'm trying to import pycassa library in a Python project in Aptana 3, but in the line "import pycassa" it show me the next error: "Unresolved import: pycassa". I installed pycassa with easy install and if I run "import pycassa" in a python shell it run with no errors. If I run the Aptana project run with no errors too, but the error mark continues. Why?
Sorry for my english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对我来说唯一可行的解决方案:打开菜单“窗口”→“首选项”→“解释器 - Python”,然后单击“应用”按钮,选择您的解释器,然后“确定”。 Pydev 将重新扫描所有包,几秒钟后所有未解析的导入都会消失。
不幸的是,我必须在每次重新启动时执行这些步骤,因为 Pydev 在重新启动后总是“忘记”一些包......
The only working solution for me: open menu “Window” → “Preferences” → “Interpreter - Python”, then click button “Apply”, select your interpreter and then “OK”. Pydev will rescan all packages and in some seconds all unresolved imports disappear.
Unfortunately I have to do these steps on every restart because Pydev always “forget” some packages after restart…
我对 Tastypie 也有同样的问题。我尝试使用 Preferences-PyDev PUTHONPATH 将外部库添加到项目中,但它对我不起作用...
但后来我找到了解决方案:Window-Preferences-PyDev-Interpreter Python-Libraries-New文件夹(按钮)。选择包含所需库的文件夹,然后 Aptana 应该可以正常工作。
I had the same problem with Tastypie. I tried to add external library to project using Preferences-PyDev PUTHONPATH, but it didn't work for me...
But then I found solution: Window-Preferences-PyDev-Interpreter Python-Libraries-New folder (Button). Choose folder with needed library and Aptana should work fine then.