我在理解导入带有使用setup.py安装的扩展的python包时遇到了一些问题。包是'gmes',它有4个扩展模块,它们是.so文件。
我得到的结果略有不同,具体取决于我从哪个目录启动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
>>>