无法从已安装的软件包加载python扩展

时间:2015-11-02 20:48:48

标签: python import python-extensions

我在理解导入带有使用setup.py安装的扩展的python包时遇到了一些问题。包是'gmes',它有4个扩展模块,它们是.so文件。

  1. 首次尝试加载包gmes会出现有关符号c0
  2. 的错误
  3. 加载包含该符号的扩展模块_constant.so,然后重新加载'gmes'包,清除该符号错误并引入有关第二个扩展模块'_pw_material.so'的新错误。
  4. 明确加载第二个扩展模块对第三次尝试加载'gmes'时丢失的消息没有影响。
  5. 我得到的结果略有不同,具体取决于我从哪个目录启动python。看起来我错过了一些关于pythons包和扩展的约定的简单方法。

    还有一个问题建议使用LD_LIBRARY_PATH和ldconfig。我只尝试过LD_LIBRARY_PATH但它没有用。

    任何想法都赞赏!

    jb@dellxps13:~/Downloads/gmes-0.9.5/gmes$ python
    Python 2.7.9 (default, Apr  2 2015, 15:33:21) 
    [GCC 4.9.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> import gmes
    No module named psyco. Execution speed might be slow.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/gmes/__init__.py", line 51, in <module>
        from fdtd import *
      File "/usr/local/lib/python2.7/dist-packages/gmes/fdtd.py", line 24, in <module>
        from geometry import GeomBoxTree, in_range, DefaultMedium
      File "/usr/local/lib/python2.7/dist-packages/gmes/geometry.py", line 22, in <module>
        from pygeom import *
      File "/src/pygeom.pyx", line 9, in init gmes.pygeom (src/pygeom.c:29837)
      File "/src/material.pyx", line 23, in init gmes.material (src/material.c:48954)
    ImportError: cannot import name c0
    >>> import _constant
    >>> import gmes
    No module named psyco. Execution speed might be slow.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/gmes/__init__.py", line 51, in <module>
        from fdtd import *
      File "/usr/local/lib/python2.7/dist-packages/gmes/fdtd.py", line 25, in <module>
        from file_io import Probe
      File "/usr/local/lib/python2.7/dist-packages/gmes/file_io.py", line 23, in <module>
        from pw_material import MaterialElectricReal, MaterialElectricCmplx
    ImportError: No module named pw_material
    >>> import _pw_material
    >>> import gmes
    No module named psyco. Execution speed might be slow.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/gmes/__init__.py", line 51, in <module>
        from fdtd import *
      File "/usr/local/lib/python2.7/dist-packages/gmes/fdtd.py", line 25, in <module>
        from file_io import Probe
      File "/usr/local/lib/python2.7/dist-packages/gmes/file_io.py", line 23, in <module>
        from pw_material import MaterialElectricReal, MaterialElectricCmplx
    ImportError: No module named pw_material
    >>> 
    

0 个答案:

没有答案