Nicolai Anton Lynnerup
Nicolai Anton Lynnerup

Reputation: 252

ImportError: No module named usb.core (Working in terminal, not in Eclipse)

I'm trying to get the pyUSB to work on my Ubuntu 14.04 distribution, more specifically in Eclipse. I've installed the package several times using different methods, and the last one combined with some magic did the trick! It is working in the Terminal (see image)

enter image description here

But I cannot import the usb.core lib in Eclipse. I still get that error ImportError: No module named usb.core

enter image description here

Here is my code:

import usb.core

dev = usb.core.find(idVendor=0x05fe,idProduct=0x1010)
if dev is None:    
    raise ValueError('Device not found')
else:
    print('Device found')

Can anyone please help me getting this to work in Eclipse? Thanks in advance!

Upvotes: 3

Views: 5774

Answers (1)

MattDMo
MattDMo

Reputation: 102842

In your PyDev Package Explorer, it looks to me like your project is associated with /usr/local/bin/python3.2. However, when you run python from the command line, you're running version 2.7.6. Find out where your python binary lives by running which python on the command line (it'll probably return /usr/bin/python), then configure Eclipse to use that version for your projects.

Upvotes: 2

Related Questions