ich arbeite mit xubuntu und spyder und python3.
Ich will pyusb installieren.
Das ging mit pip auch ohne Fehlermeldung.
Leider ist das Beispielprogram nicht operabel: es kann die usb nicht finden, die entsprechende Anweisung steht in der ersten Zeile.
Ich vermute, dass die zweite Anweisung auch nicht gefunden wird.
Ich habe usblib installiert.(glaube ich jedenfalls).
Was ist erforderlich, um den Zugriff einzurichten?
Welche Informationen fehlen noch?Grüsse
Gruss aus Köln (Regen, 22°)
Robert
pyusb installieren
-
- User
- Beiträge: 12
- Registriert: Mittwoch 28. Oktober 2015, 12:48
------8<--------der Code aus dem Beispiel----------8<
# -*- coding: utf-8 -*-
import usb.core
import usb.util
# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
assert ep is not None
# write the data
ep.write('test')
---------8<------------folgend: Fehlermeldung-------
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: runfile('/home/rfr/.spyder2-py3/pyusb-test.py', wdir='/home/rfr/.spyder2-py3')
Traceback (most recent call last):
File "<ipython-input-1-9f08422f8540>", line 1, in <module>
runfile('/home/rfr/.spyder2-py3/pyusb-test.py', wdir='/home/rfr/.spyder2-py3')
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/home/rfr/.spyder2-py3/pyusb-test.py", line 2, in <module>
import usb.core
ImportError: No module named 'usb'
----------------------8<-----------------ENDE----
# -*- coding: utf-8 -*-
import usb.core
import usb.util
# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
assert ep is not None
# write the data
ep.write('test')
---------8<------------folgend: Fehlermeldung-------
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: runfile('/home/rfr/.spyder2-py3/pyusb-test.py', wdir='/home/rfr/.spyder2-py3')
Traceback (most recent call last):
File "<ipython-input-1-9f08422f8540>", line 1, in <module>
runfile('/home/rfr/.spyder2-py3/pyusb-test.py', wdir='/home/rfr/.spyder2-py3')
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/home/rfr/.spyder2-py3/pyusb-test.py", line 2, in <module>
import usb.core
ImportError: No module named 'usb'
----------------------8<-----------------ENDE----
Ok, dann noch mal die Ausgabe von pip show, so sieht's auf meinem Mac aus:
Code: Alles auswählen
$ pip show pyusb
Name: pyusb
Version: 1.0.0
Summary: Python USB access module
Home-page: http://pyusb.sourceforge.net
Author: Wander Lairson Costa
Author-email: wander.lairson@gmail.com
License: BSD
Location: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
Requires:
-
- User
- Beiträge: 12
- Registriert: Mittwoch 28. Oktober 2015, 12:48
Bitte sehr:
rfr@rfr-ThinkPad-T540p:~$ pip show pyusb
Name: pyusb
Version: 1.0.0
Summary: Python USB access module
Home-page: http://pyusb.sourceforge.net
Author: Wander Lairson Costa
Author-email: wander.lairson@gmail.com
License: BSD
Location: /home/rfr/.local/lib/python2.7/site-packages
Requires:
rfr@rfr-ThinkPad-T540p:~$ ^C
rfr@rfr-ThinkPad-T540p:~$
------------------------8<-----------------------------------8<----------------------------
wieso 2.7??
Gruss
Robert
rfr@rfr-ThinkPad-T540p:~$ pip show pyusb
Name: pyusb
Version: 1.0.0
Summary: Python USB access module
Home-page: http://pyusb.sourceforge.net
Author: Wander Lairson Costa
Author-email: wander.lairson@gmail.com
License: BSD
Location: /home/rfr/.local/lib/python2.7/site-packages
Requires:
rfr@rfr-ThinkPad-T540p:~$ ^C
rfr@rfr-ThinkPad-T540p:~$
------------------------8<-----------------------------------8<----------------------------
wieso 2.7??
Gruss
Robert
Weil du einfach pip benutzt hast. Das defaulted wahrscheinlich auf pip2.7. Es ist immer wichtig sich bei pip zu vergewissern, dass es das richtige ist. Besser ist es den voll qualifizierten Namen zu benutzen. pip3.5 zb.
-
- User
- Beiträge: 12
- Registriert: Mittwoch 28. Oktober 2015, 12:48
Also alles deinstallieren und dann mit pip3 nochmal.
Gibt es irgendwo eine Erklärung zu pip?
Gibt es irgendwo eine Erklärung zu pip?
-
- User
- Beiträge: 12
- Registriert: Mittwoch 28. Oktober 2015, 12:48
Habe ich gemacht, result:
installieren in python3 scheint also nicht zu funktionieren.
Das kann daran liegen, dass die version von pyusb v==1.0 ist.
Ich will das aber für python 3 und nicht 2.7 installieren.
Weitere Hinweise?
rfr@rfr-ThinkPad-T540p:~$ pip install pyusb==3.5
Collecting pyusb==3.5
Could not find a version that satisfies the requirement pyusb==3.5 (from versions: 1.0.0a2, 1.0.0a3, 1.0.0b1, 1.0.0b2, 1.0.0)
No matching distribution found for pyusb==3.5
ich gemacht, Ergebnis:
installieren in python3 scheint also nicht zu funktionieren.
Das kann daran liegen, dass die version von pyusb v==1.0 ist.
Ich will das aber für python 3 und nicht 2.7 installieren.
Weitere Hinweise?
rfr@rfr-ThinkPad-T540p:~$ pip install pyusb==3.5
Collecting pyusb==3.5
Could not find a version that satisfies the requirement pyusb==3.5 (from versions: 1.0.0a2, 1.0.0a3, 1.0.0b1, 1.0.0b2, 1.0.0)
No matching distribution found for pyusb==3.5
ich gemacht, Ergebnis:
@rfr-mailbox@gmx.de: Du solltest ja auch pyusb für Python Version 3.5 und nicht die pyusb-Version 3.5 installieren.
[codebox=bash file=Unbenannt.bsh]
pip3 install pyusb[/code]
[codebox=bash file=Unbenannt.bsh]
pip3 install pyusb[/code]
Sirius zeigt wie's geht, und wenn du dir mal meinen pip show output genauer anschaust siehst du auch, das das bei *mir* durchaus fuer Python 3.5 installiert ist.
Und die Pip-Version hat was mit der Python-Version, nicht der Paketversion zu tun.
Und die Pip-Version hat was mit der Python-Version, nicht der Paketversion zu tun.
-
- User
- Beiträge: 12
- Registriert: Mittwoch 28. Oktober 2015, 12:48
Alles gemacht. Er hat jetzt eine andere Fehlermeldung und offensichtlich das usb-zeug gefunden.
Vielen Dank!!
(Drohung: ich komme gegebenenfalls wieder )
Gruss
Robert
Vielen Dank!!
(Drohung: ich komme gegebenenfalls wieder )
Gruss
Robert