问题
I just installed Eclipse Indigo, in Ubuntu 10.04 LTS, and installed Pydev with it. I did the following:
(1) set python interpreters by pressing Auto config in Window > Preferences > PyDev > Editor > Interpreter-Python
(2) set system Pythonpath through Window > Preferences > PyDev > Editor > Interpreter-Python
(a) pressed New Folder and added /usr/lib/python2.6
I am trying to run an openrave code in eclipse and have all the required openrave libraries installed. "openravepy" is in the directory /usr/lib/python2.6/dist-packages.
My problems is that it seems that the import is not successful that a few function calls return error type : PyDev Problem. It says 'Undefined Variable: ...'
here are some snippets of the code:
from itertools import izip
from openravepy import *
from numpy import *
import time
class FastGrasping:
class GraspingException(Exception):
def __init__(self,args):
self.args=args
def __init__(self,robot,target):
self.robot = robot
self.ikmodel = databases.inversekinematics.InverseKinematicsModel(robot=robot,iktype=IkParameterization.Type.Transform6D)
--databases is part of openravepy and described as undefined variable.
I've read a few threads and I already did the following
(1) Remove and readd pydev
(2) I've run the code previously, it used to work with eclipse helios and pydev setup. so, I Deleted and reinstall eclipses helios and indigo and repeat the process of adding pydev and pythonpath again and again.
Anyone know hows can I fix this? or is this a bug in pydev?
thanks in advance.
cheers
回答1:
Have you tried adding 'openravepy' to the forced builtins (see: http://pydev.org/manual_101_interpreter.html for details)?
Also, does it run properly? (i.e.: the issue only happens in the PyDev code-analysis or also when you run the code in Python from within PyDev?)
回答2:
I have found that the Auto config does not always auto select the site-packages directory. This is where most installed modules reside, numpy for example on my machine. Try doing auto-config once more and also select the directory ending in site-packages, if you have not done so already.
来源:https://stackoverflow.com/questions/7966621/pydev-import-in-eclipse