0

有人为python成功安装了apgl图形库吗?http://packages.python.org/apgl/ python 中是否有其他替代图形库可以与 apgl 执行相同的操作并具有相同的简单性?

目前我正在使用 Ubuntu 12.04 发行版,并且我已经在此处安装了依赖库:

sudo apt-get install pip
sudo pip install numpy
sudo apt-get install libatlas-base-dev gfortran g++
sudo pip install scipy
sudo pip install matplotlib
sudo pip install agpl

它安装成功,然后当我这样做时:

>>> import apgl
>>> apgl.test()

我遇到错误:

>>> apgl.test()
Running tests from /usr/local/lib/python2.7/dist-packages/apgl
..............s....................................................E...........E.................................................ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.....................................................................E.........E.........................................sssssssss...sssssss..sssssssssssssssssssssssssssss.................................s....s..ss..........
======================================================================
ERROR: testLoad (graph.test.SparseGraphTest.SparseGraphTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/test/MatrixGraphTest.py", line 1619, in testLoad
    graph.save(tempFile)
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 558, in save
    import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 464, in <module>
    class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

======================================================================
ERROR: testPickle (graph.test.SparseGraphTest.SparseGraphTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/test/MatrixGraphTest.py", line 2309, in testPickle
    output = pickle.dumps(graph)
  File "/usr/lib/python2.7/pickle.py", line 1374, in dumps
    Pickler(file, protocol).dump(obj)
  File "/usr/lib/python2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib/python2.7/pickle.py", line 306, in save
    rv = reduce(self.proto)
  File "/usr/lib/python2.7/copy_reg.py", line 84, in _reduce_ex
    dict = getstate()
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 1287, in __getstate__
    self.save(tempFile.name)
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 558, in save
    import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 464, in <module>
    class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

======================================================================
ERROR: testLoad (graph.test.DenseGraphTest.DenseGraphTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/test/MatrixGraphTest.py", line 1619, in testLoad
    graph.save(tempFile)
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 558, in save
    import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 464, in <module>
    class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

======================================================================
ERROR: testPickle (graph.test.DenseGraphTest.DenseGraphTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/test/MatrixGraphTest.py", line 2309, in testPickle
    output = pickle.dumps(graph)
  File "/usr/lib/python2.7/pickle.py", line 1374, in dumps
    Pickler(file, protocol).dump(obj)
  File "/usr/lib/python2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib/python2.7/pickle.py", line 306, in save
    rv = reduce(self.proto)
  File "/usr/lib/python2.7/copy_reg.py", line 84, in _reduce_ex
    dict = getstate()
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 1287, in __getstate__
    self.save(tempFile.name)
  File "/usr/local/lib/python2.7/dist-packages/apgl/graph/AbstractMatrixGraph.py", line 558, in save
    import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 464, in <module>
    class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

----------------------------------------------------------------------
Ran 423 tests in 46.433s

FAILED (errors=4, skipped=120)
4

1 回答 1

0

在我看来,您遇到了某种 Ubuntu 问题。

   File "/usr/lib/python2.7/zipfile.py", line 464, in <module>
   class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

表示您的 python 安装有问题。

你是自己安装的吗?

另外......虽然 pip 很棒,但您应该更喜欢使用包管理器,并且只有当您必须安装真正的新版本或非打包版本时,您才应该使用 pip。因此,不要使用 pip do 安装,

apt-get install python-scipy python-numpy python-matplotlib

然后才用 pip 安装 apgl。

我在 Debian Wheezy 上成功测试了我的安装 apgl,并在今天(2012 年 9 月 13 日)更新了软件包,测试结果很好。

 In [22]: apgl.test()
Running tests from /usr/local/lib/python2.7/dist-packages/apgl
......./usr/lib/python2.7/dist-packages/scipy/sparse/compressed.py:486: SparseEfficiencyWarning: changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
  SparseEfficiencyWarning)
....s...........................................................................................ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...................................................................................................................................................sssssssss...ssssssssssssssssssssssssssssssssssss......................s....s.........................ss
----------------------------------------------------------------------
Ran 423 tests in 25.454s

OK (skipped=120)
于 2012-09-13T05:52:01.230 回答