简体   繁体   中英

Error in python-igraph 'module' object has no attribute 'Graph'

I have installed igraph on Pycharm for Windows.

import igraph

yields no errors.

import igraph
print igraph.__version__

yields: 0.1.5.

import igraph
dir(igraph)

yields nothing...

import igraph
g = igraph.Graph(1)

yields:

Traceback (most recent call last):
File "C:/Users/Margaret/PycharmProjects/untitled/trial.py", line 2, in g = igraph.Graph(1)
AttributeError: 'module' object has no attribute 'Graph'

Does anyone know what the issue might be? I've looked at all the previously asked questions I could find and I haven't found an answer that will work for my case. Thanks.

There are two igraph libraries on PyPI, igraph and python-igraph .

You have igraph installed, which is the wrong one. Uninstall it using:

pip uninstall igraph

As you are on Windows you probably need a pre-compiled distribution, called a wheel.

This site has lots of wheels which can be installed using pip . Here is the wheel for python-igraph .

Install using, eg:

pip install python_igraph-0.7.1.post4-cp27-none-win32.whl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM