如何将 python“库”添加到 Eclypse 和 pydev
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3675585/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add python "libraries" to Eclypse and pydev
提问by
I am trying to learn how to use Abaqus Scripting. I just downloaded Eclipse and added the pydev plugin. Everything seems to work fine.
我正在尝试学习如何使用 Abaqus 脚本。我刚刚下载了 Eclipse 并添加了 pydev 插件。一切似乎都运行良好。
What I want to do now is to add all the built-in Abaqus libraries or modules.
我现在想做的是添加所有内置的 Abaqus 库或模块。
I would like, for example, the IDE to display the class members and methods when I press the ".".
I would like to see if the code compiles fine without running it into Abaqus.
例如,当我按下“.”时,我希望 IDE 显示类成员和方法。
我想看看代码是否可以在不将其运行到 Abaqus 中的情况下正常编译。
How can I do this in Eclipse? Or should I change IDE? Or is it not possible?
我怎样才能在 Eclipse 中做到这一点?或者我应该改变IDE?或者不可能?
I just tried, but no success, I don't fully understand what I need to do. I am very much a beginner at Python (today is my second day). I have in the abaqus folder the python folder. It leads to two subfolders:
我刚刚尝试过,但没有成功,我不完全明白我需要做什么。我是 Python 的初学者(今天是我的第二天)。我在 abaqus 文件夹中有 python 文件夹。它导致两个子文件夹:
-lib: full of .pyc file (I guess precompiled Python files)
-obj: full of windows dll and the python.exe which I guess is the interpeter.
-lib:充满 .pyc 文件(我猜是预编译的 Python 文件)
-obj:充满了windows dll和python.exe,我猜是interpeter。
I also tried to add this interpreter but Eclipse said it can not add it (Error getting info on the interpreter)
我也尝试添加这个解释器,但 Eclipse 说它不能添加它(在解释器上获取信息时出错)
I just added the whole lib and obj folder. Maybe once I get more involved in Python I can give you more detailed explanations.
我刚刚添加了整个 lib 和 obj 文件夹。也许一旦我更多地参与 Python,我可以给你更详细的解释。
New information:
新讯息:
When I try to run the script it says:
当我尝试运行脚本时,它说:
ImportError: Bad magic number in C:\SIMULIA\Abaqus.9-1\Python\Lib\abaqus.pyc
Is there a compatibility problem, maybe with different versions of the Python interpreters?
是否存在兼容性问题,可能与不同版本的 Python 解释器有关?
采纳答案by Manoj Govindan
You can add these libraries to the settings to get the effect you want. This can be done in the Librariessetting accessed through Window > Preferences > PyDev > Interpreter - Python > Libraries. Add the .eggor source folder of the libraries you want to add and click Applyfollowed by OK.
您可以将这些库添加到设置中以获得您想要的效果。这可以在通过Libraries访问的设置中完成Window > Preferences > PyDev > Interpreter - Python > Libraries。添加.egg或源文件夹要添加,然后单击库的Apply后面OK。

