在树莓派上运行picam导入错误

时间:2013-11-22 08:14:59

标签: python raspberry-pi importerror

我正试图在我的树莓派上运行picam。不幸的是,我没有解决以下导入错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-ae50f21e1c18> in <module>()
----> 1 import picam
      2 import time

/usr/local/lib/python2.7/dist-packages/picam/__init__.py in <module>()
      1 # Copyright (c) 2013 Sean Ashton
      2 # Licensed under the terms of the MIT License (see LICENSE.txt)
----> 3 from _picam import *
      4 import StringIO
      5 from PIL import Image

ImportError: /usr/local/lib/python2.7/dist-packages/picam/_picam.so: cannot open shared object file: No such file or directory

我一直在寻找这个地方(例如:cannot open shared object file: No such file or directory),但到目前为止还没有成功。由于一大堆缺少的库(mmal.h,vcos.h等),重新编译也无法正常工作。

更新

pi@raspberrypi ~ $ ls -l /usr/local/lib/python2.7/dist-packages/picam
total 48                                                                    
-rw-r--r-- 1 root staff  1819 Nov 18 14:47 __init__.py                      
-rw-r--r-- 1 root staff  2903 Nov 21 23:29 __init__.pyc                     
-rw-r--r-- 1 root staff 39567 Nov 18 14:47 _picam.so   

UPDATE2:

pi@raspberrypi ~ $ ldd /usr/local/lib/python2.7/dist-packages/picam/_picam.so
    not a dynamic executable

UPDATE3:

pi@raspberrypi ~ $ file /usr/local/lib/python2.7/dist-packages/picam/_picam.so 

/usr/local/lib/python2.7/dist-packages/picam/_picam.so:ELF 32位LSB共享对象,ARM,版本1(SYSV),动态链接,BuildID [sha1] = 0xe403bf379f8c1dc2cb82df774ac3f11998661ff1,没有被剥夺

readelf -d /usr/local/lib/python2.7/dist-packages/picam/_picam.so 

Dynamic section at offset 0x700c contains 37 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libmmal_core.so]
 0x00000001 (NEEDED)                     Shared library: [libmmal_util.so]
 0x00000001 (NEEDED)                     Shared library: [libmmal_vc_client.so]
 0x00000001 (NEEDED)                     Shared library: [libvcos.so]
 0x00000001 (NEEDED)                     Shared library: [libbcm_host.so]
 0x00000001 (NEEDED)                     Shared library: [libpython2.7.so.1.0]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libvchiq_arm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000e (SONAME)                     Library soname: [_picam.so]
 0x0000000f (RPATH)                      Library rpath: [/home/pi/SOURCE/userland/build/lib]
 0x0000000c (INIT)                       0x1d88
 0x0000000d (FINI)                       0x5840
 0x00000019 (INIT_ARRAY)                 0xf000
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
 0x0000001a (FINI_ARRAY)                 0xf004
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0xf8
 0x6ffffef5 (GNU_HASH)                   0x444
 0x00000005 (STRTAB)                     0xcbc
 0x00000006 (SYMTAB)                     0x5bc
 0x0000000a (STRSZ)                      2330 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0xf154
 0x00000002 (PLTRELSZ)                   712 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x1ac0
 0x00000011 (REL)                        0x16f8
 0x00000012 (RELSZ)                      968 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x16b8
 0x6fffffff (VERNEEDNUM)                 2
 0x6ffffff0 (VERSYM)                     0x15d6
 0x6ffffffa (RELCOUNT)                   114
 0x00000000 (NULL)                       0x0

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

通过PIP安装时,软件包应包含共享对象文件。它并不理想,但您可以从github自行下载并将其放在所需的文件夹中。或者,您可以尝试从PIP重新安装。 https://github.com/ashtons/picam/tree/master/picam

ls -l /usr/local/lib/python2.7/dist-packages/picam的输出在你的pi上是什么样的?