python libusb多线程_python - Python libusb pyusb“马赫,但架构错误” - 堆栈内存溢出...

pyusb模块遇到了一些麻烦。 我将问题缩小为一行,并创建了一个小的示例脚本来复制错误。

#!/usr/bin/env python

"""

This module was created to isolate the problem in the pyusb package.

Operating system: Mac OS 10.6.3

Python Version: 2.6.4

libusb 1.0.8 has been successfully installed using:

sudo port install libusb

I have also tried modifying /opt/local/etc/macports/macports.conf to force

the i386 architecture instead of x86_64.

"""

from ctypes import *

import ctypes.util

libname = ctypes.util.find_library('usb-1.0')

print 'libname: ', libname

l = CDLL(libname, RTLD_GLOBAL)

# RESULT:

#libname: /usr/local/lib/libusb-1.0.dylib

#Traceback (most recent call last):

# File "./pyusb_problem.py", line 7, in

# l = CDLL(libname, RTLD_GLOBAL)

# File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 353, in __init__

# self._handle = _dlopen(self._name, mode)

#OSError: dlopen(/usr/local/lib/libusb-1.0.dylib, 10): no suitable image found. Did find:

# /usr/local/lib/libusb-1.0.dylib: mach-o, but wrong architecture

# End of File

此脚本成功在Ubuntu 10.04上运行。

我曾尝试为32位(i386)而不是x86_64(OS 10.6的默认设置)构建libusb模块(直接从源代码和通过macports),但是我收到相同的错误。

预先感谢您的帮助!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值