Windows 7 64位
Python 2.7.7 64位Anaconda
尝试从https://pypi.python.org/pypi/python-igraph安装python-igraph python-igraph-0.7.1-4.tar.gz。
我已通过Install python-igraph with the anaconda distribution (windows),Can I install Python windows packages into virtualenvs?和相关链接来调试问题。
我理解问题出现是因为没有C核心。当我尝试通过easy_install安装时错误消息也包含此消息 -
Cannot find the C core of igraph on this system using pkg-config.
WARNING: we were not able to detect where igraph is installed on
your machine (if it is installed at all). We will use the fallback
library and include pathss hardcoded in setup.py and hope that the
C core of igraph is installed there.
If the compilation fails and you are sure that igraph is installed
on your machine, adjust the following two variables in setup.py
accordingly and try again:
- LIBIGRAPH_FALLBACK_INCLUDE_DIRS
- LIBIGRAPH_FALLBACK_LIBRARY_DIRS
您能否提供任何解决方案的指示。 感谢。
答案 0 :(得分:6)
Christoph Gohlke's page在Windows上托管几个Python预编译包,包括igraph的Python界面。从that page下载与您的Python版本对应的Python轮,并使用pip
命令进行安装。由于您使用的是Python 2.7,因此您需要在其文件名中包含cp27
的那个。
答案 1 :(得分:5)
我遇到了同样的问题,无论是通过pycharm安装程序还是pip安装我都无法安装python-igraph。
Tamás给出的解决方案对我有用。 从Christoph Gohles页面下载您需要的文件。
打开终端
> cd ./ContainingFolder
> pip install python_igraph-0.7.1.post4-cp34-none-win_amd64.whl
Processing c:\users\username\ContainingFolder\python_igraph-0.7.1.post4-cp34-none-win_amd64.whl
Installing collected packages: python-igraph
Successfully installed python-igraph-0.7.1.post4
答案 2 :(得分:0)
我知道这来得很晚并且可以作为答案,但是Christoph Gohlke的page仍然以whl格式包含了许多软件包的更新库,甚至是igraph。花了我很多时间来解决这个问题,但是我终于做到了。
这些是我采取的步骤:
首先要做的是从here安装最新版本的numpy + mkl。检查您下载的版本是否与您的Python版本相关。下载后,您需要在终端中使用以下命令来安装它:pip install numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl
(检查下载文件的文件名并在命令中替换它)。
其次,您需要安装最新版本的wheel以读取whl文件,您将在下一阶段下载该文件。这不是必需的,但就我而言,由于某种原因,pip没有阅读它就不会读取whl文件。您可以使用以下命令在终端pip install wheel
中进行安装。
第三,您需要下载并安装Python版本的Cairo。这是一个可以可视化许多图形图形的库。没有它,igraph库将无法正常运行。该库由Christoph Gohlke在this link中提供。检查您下载的版本是否与您的Python版本相关。下载后,您需要在终端中使用以下命令来安装它:pip install pycairo‑1.18.0‑cp37‑cp37m‑win32.whl
(检查下载文件的文件名并在命令中替换它)。
最后,您可以安装igraph。在这里再次需要从Christoph Gohlke的site下载它并安装它。再次在下载时检查与您的Python版本匹配的软件包,然后使用终端机pip install python_igraph-0.7.1.post6-cp37-cp37m-win32.whl
中的命令再次安装该软件包(检查下载文件的文件名并在命令中替换它)。
安装软件包后,可以使用类似于以下内容的工具开始工作:
from graphframes import *
from igraph import *
gf = GraphFrame(vertex, edge)
ig = Graph.TupleList(gf.edges.collect(), directed=True)
plot(ig)
希望这有助于打破神话:)