Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

pyusb

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!

like image 760
Nicolai Anton Lynnerup Avatar asked Dec 19 '25 01:12

Nicolai Anton Lynnerup


1 Answers

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.

like image 146
MattDMo Avatar answered Dec 20 '25 16:12

MattDMo