安装python表时遇到问题。 我的路径或依赖项中有些东西丢失或损坏,我无法解决。
当我使用使用表的Python程序时,它会返回:
File "/usr/lib/python2.7/dist-packages/io.py", line 331, in
def bget(imfile,shp=None,unpackstr=N.int16,bytesperpixel=2.0,sliceinit=0):
AttributeError: 'module' object has no attribute 'int16'
只需从python shell导入表:
...
File "/usr/lib/python2.7/gzip.py", line 36, in
class GzipFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'
表安装在:
/usr/local/lib/python2.7/dist-packages/
我的PYTHONPATH是:
['', '/usr/local/lib/python2.7/dist-packages/bbfreeze-1.0.2-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/altgraph-0.9-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/phylonetwork-1.0b6-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/tables-3.2.0-py2.7-linux-x86_64.egg', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
我错过了什么?
任何healp都会被贬低。
答案 0 :(得分:3)
面对同样的问题,我找到了这个有趣的答案:How to solve AttributeError when importing igraph?
您应该检查包裹名称io
和' N'在你自己的来源。
确保它们不会重叠io
内置包和numpy的定义(您似乎已导入as N
)
重命名它们为我解决了这个问题。