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

ε祈祈猫儿з 提交于 2020-01-02 07:08:07

问题


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)

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

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!


回答1:


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.



来源:https://stackoverflow.com/questions/24790690/importerror-no-module-named-usb-core-working-in-terminal-not-in-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!