主要参考资料: (python-igraph's documentation)
http://hal.elte.hu/~nepusz/development/igraph/tutorial/index.html
一、iGraph的安装
参考 http://hal.elte.hu/~nepusz/development/igraph/tutorial/install.html#igraph-on-windows
igraph
is primarily a library written in C. It is not
a standalone program, nor it is
a Python package that you can just drop on your Python path to start using it. Therefore,
if you would like to exploit igraph
‘s functionality in Python, you must install
a few packages. Do not worry, though, there are precompiled packages for the major operating
systems, so you will not have to compile igraph
from source unless you use an esoteric
operating system or you have specific requirements (i.e., adding a custom patch to igraph
‘s
C core). Precompiled packages are often called binary packages
, while the raw source code
is usually referred to as the source package
.
In general, you should almost always opt for the binary package unless a binary package is not
available for your platform or you have some local modifications that you want to incorporate
into igraph
‘s source.
Installation from a binary package
在此之前,先要安装Python的合适版本,因为某些版本没有对应的igraph和cairo(我用python-2.5.2.msi)
igraph
on Windows:igraph被安装到C:\Python25\Lib\site-packages\igraph中
There is a Windows installer for igraph
‘s Python interface on the
Python Package Index
.
Download the one that is suitable for your Python version (currently
there are binary packages for Python 2.4 and Python 2.5, though it
might change in the future)(我用的是python-igraph-0.5.1.win32-py2.5.exe)
. To test the installed package, launch
your favourite Python IDE and type the following:
>>> import igraph.test
>>> igraph.test.test()
The above commands run the bundled test cases to ensure that everything
is fine with your igraph
installation.
Graph plotting in igraph
on Windows:cairo和dll被安装到C:\Python25\Lib\site-packages\cairo中
Graph plotting in igraph
is implemented using a third-party package
called Cairo
. If you want to create
publication-quality plots in igraph
on Windows, you must also install
Cairo and its Python bindings. The Cairo project does not provide
pre-compiled binaries for Windows, but other projects depending on
Cairo do, so the preferred way to install Cairo on Windows along with
its Python bindings is as follows:
- Get the latest PyCairo for Windows installer from
http://ftp.gnome.org/pub/gnome/binaries/win32/pycairo/1.8
. Make sure you
grab the one that matches your Python version. At the time of writing,
the above folder contained installers for Python 2.6 only. You may
also try and go one level up, then down then 1.4 subfolder – these are
older versions, but they work with Python 2.5 and Python 2.6 as well.
-
Install PyCairo using the installer
.(我用的是pycairo-1.4.12-2.win32-py2.5.exe)
The installer extracts the necessary
files into Lib\site-packages\cairo
within the folder where Python is
installed. Unfortunately there are some extra DLLs which are required to
make Cairo work, so we have to get these as well.
- Head to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
and get
the binary versions of Cairo (cairo_1.8.10-3_win32.zip
at the time of
writing), Fontconfig (fontconfig_2.8.0-2_win32.zip
), Freetype
(freetype_2.4.4-1_win32.zip
), Expat (expat_2.0.1-1_win32.zip
),
libpng
(libpng_1.4.3-1_win32.zip
) and zlib
(zlib_1.2.5-2_win32.zip
). Version numbers may vary, so be
adaptive! Each ZIP file will contain a bin
subfolder with a DLL file in
it. Put the following DLLs in Lib\site-packages\cairo
within your Python
installation:
-
freetype6.dll
(from freetype_2.4.4-1_win32.zip
)
-
libcairo-2.dll
(from cairo_1.8.10-3_win32.zip
)
-
libexpat-1.dll
(from expat_2.0.1-1_win32.zip
)
-
libfontconfig-1.dll
(from fontconfig_2.8.0-2_win32.zip
)
-
libpng14-14.dll
(from libpng_1.4.3-1_win32.zip
)
-
zlib1.dll
(from zlib_1.2.5-2_win32.zip
).
Having done that, you can launch Python again and check if it worked:
>>> from igraph import *
>>> g = Graph.Famous("petersen")
>>> plot(g)
---------------------------------------------------------------------------------------------------------------------------------
注意:在运行时,我遇到了如下错误,最后发现时没有将cairo的dll加入环境变量path
下面是解决这个问题时参考的文档:
Hi, I have just installed igraph and I am having a problem with plotting.
I have followed the instructions on the documentation site
http://www.cs.rhul.ac.uk/home/tamas/development/igraph/tutorial/install.html#graph-plotting-in-igraph-on-windows
which includes installing pycairo, and putting the required dll files into
Python2.6\Lib\site-packages\cairo
igraph itself has installed properly, as running
>>> import igraph.test
>>> igraph.test.test()
gives no errors, and all tests work.
However, when I try to run
from igraph import *
g = Graph.Famous("petersen")
summary(g)
plot(g)
I get the following error:
Traceback (most recent call last):
File "C:\Documents and Settings\fulford\Desktop\netstuff\test1.py", line 4,
in <module>
plot(g)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 762, in plot
result = Plot(target, bbox)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 222, in __init__
self._surface_was_created=not isinstance(target, cairo.Surface)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 51, in
__getattr__
raise TypeError, "plotting not available"
TypeError: plotting not available
I also tried the following:
import cairo
but got the error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import cairo
File "C:\Python26\lib\site-packages\cairo\__init__.py", line 1, in <module>
from _cairo import *
ImportError: DLL load failed: The specified module could not be found.
I am fairly new to python, so am wondering if there is something else I needed
to do, like add something to my path variable so that the dll files are found?
Any help or suggestions anyone can give me would be much appreciated, sicve I
would very much like to use this software. .
Thanks Glenn.
PS platform details:
Platform: Windows XP
Python version 2.6 (32 bitr) (enthought python distribution 6.2)
Dr Glenn Fulford +61 7 313 85196 QUT Mathematical Sciences,
GPO Box 2343 Brisbane, Qld AUSTRALIA 4001. Cricos no. 00213J
email: address@hidden;
-------------------------------------------------------------------------------------
Dear Glenn,
It seems like the Python bindings of Cairo are not installed properly on
your machine -- igraph simply reports this when it says "plotting not
available".
I checked a working installation on Windows XP (32-bit) and the
following files should be present in
c:\python26\lib\site-packages\cairo:
__init__.py
_cairo.pyd
libcairo-2.dll
libexpat-1.dll
libfontconfig-1.dll
libpng14-14.dll
zlib1.dll
The error message you see means that Python finds __init__.py in the
cairo subfolder successfully, and it tries to import _cairo.pyd from
there. (.pyd files are like ordinary .dll files, Python just uses a
different extension to distinguish them from .dlls). Unfortunately the
import can fail for at least two reasons:
1) _cairo.pyd itself is missing
2) _cairo.pyd is there, but one of its dependencies is missing.
Unfortunately, the error message is the same in both cases. So, I'd do
the following:
1. Check whether all the files I mentioned above are in the
site-packages\cairo folder. If not, install them.
2. If they are all there, download Dependency Walker from
www.dependencywalker.com and open _cairo.pyd with it. Dependency Walker
should recursively traverse the dependency tree of _cairo.pyd and report
any other DLLs that you are missing.
--
Tamas
-------------------------------------------------------------------------------------
Dear Tamas,
thanks very much for your suggestions. I beleive I eventiually tracked down the
problem.
I found the following web page very useful.
http://alex.matan.ca/install-cairo-wxpyton-pycairo-python-windows
First thing it told me was to append c:\Python26\Lib\site-packages\cairo to my
path, which I hadn't done, but this didn't fix the problem.
I then reinstalled the dll files, this time from the wxpythion site. Thiat
seemed to fix the problem. So not surre exactly which dll it was, but I can
compare themn if anyone is interested.
Glenn
二、iGraph使用
参考这里 http://www.cs.rhul.ac.uk/home/tamas/development/igraph/tutorial/tutorial.html
分享到:
相关推荐
为了解决这个问题,2023年的京东自动下单小助手软件应运而生,提供了Windows、Mac和Python三种版本,旨在帮助用户实现自动化监控和下单功能,确保在商品库存恢复时第一时间完成购买。本文将深入探讨这款工具的核心...
本资源《Java+Python实现的深度神经网络学习算法水质管理预测系统(Springboot+Vue+Python)》是一套兼具实践性与创新性的课程设计、毕业设计资源,尤其适合本科学生及Java与Python学习者深入探究深度神经网络学习...
中兴 TelnetONU1.5 版本(Windows+Python 双版本,内含教程)是一款强大的工具,它专门为中兴光猫用户设计,旨在开启 telnet 功能,修改超级密码,并修改设备的 SN。 这个版本的独特之处在于它同时提供了 Windows ...
基于Springboot+Vue+Python深度神经网络学习算法水质管理预测系统+毕业设计+源码案例+课程设计.zip
本文将深入探讨五种常见的网络拓扑结构——总线型、星型、网状、树型和环型,并介绍如何利用MATLAB和Python这两种编程语言来生成这些拓扑结构。 1. **总线型网络拓扑**:在这种结构中,所有设备共享一个主传输线,...
本次实验的目标是用编码器和解码器实现一个中文到英文的神经网络的翻译模型。 编码器使用 LSTM 的序列神经网络,将我们的目标句子通过时间序列输入,最终将一个中文的文本句子编码成一个特定维数的向量。我们这里...
综上所述,该文档提供的内容不仅包括了深度学习和Python的结合这一知识点,还涉及到了书籍出版相关的法律声明和出版信息等,反映了作为一本专业书籍在编写、编辑、出版和分销过程中所涉及的诸多细节。这些知识点对于...
该压缩包文件“基于Springboot+Vue+Python深度神经网络学习算法水质管理预测系统设计源码案例设计.zip”提供了一个完整的软件开发案例,用于构建一个水质管理预测系统。这个系统结合了三种关键技术:Spring Boot、...
Python-igraph 是一个强大的图形库,专为处理复杂网络数据而设计。它提供了丰富的功能,包括图形的创建、操作、计算属性以及可视化,使得复杂网络分析变得更为便捷。在Python环境下,igraph库是进行网络科学和图论...
程序开发软件:Eclipse/Idea + WebStorm/VsCode + Pycharm 数据库:mysql 开发技术:Springboot + Vue + Python 这个是一个水质管理和预报系统,它是一个全栈Web应用程序,使用机器学习和深度神经网络算法来预测未来...
基于PythonDjango校园社交网络系统设计 框架html + css + js + jquery+ python + django + mysql 用户类型 管理员 admin 123456 普通用户 qqq 123456 模块介绍 管理员 登录模块 系统首页 校园资讯 (发布...
基于PythonDjango校园社交网络系统设计 框架html + css + js + jquery+ python + django + mysql 用户类型 管理员 admin 123456 普通用户 qqq 123456 模块介绍 管理员 登录模块 系统首页 校园资讯 (发布...
程序开发软件:Eclipse/Idea + WebStorm/VsCode + Pycharm 数据库:mysql 开发技术:Springboot + Vue + Python 这个是一个水质管理和预报系统,它是一个全栈Web应用程序,使用机器学习和深度神经网络算法来预测未来...
在Python编程语言中,绘制关系网络图是一种常用的数据可视化方式,尤其在社交网络、生物学、信息科学等领域。这里我们主要关注如何使用NetworkX库来创建和可视化这些图形。NetworkX是一个强大的工具,它允许我们创建...
基于opencv+python+Adaboost算法基于Keras搭建CNN卷积神经网络结实现对视频中人脸的实时检测识别,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~ 基于opencv+...
**Scrapy**: Scrapy是Python的一个开源框架,专为网络爬虫设计。它提供了一整套框架来高效地抓取网站数据并处理抓取到的数据。Scrapy包括中间件、爬虫、调度器、下载器等组件,可以灵活定制以适应不同类型的爬虫需求...
【眼疾病识别】图像识别+深度学习技术+人工智能+卷积神经网络算法+计算机课设+Python+Tens_eye_check
基于Python入侵检测IDS系统1.5 框架 html + css + jquery + python 3.9 + Django + scapy + webshell(加密流木马) + 蚁剑流量识别 抓包工具 winshark,etherDetect,sniffer python manage.py runserver 0.0.0.0:8000 ...
本项目是python对AlexNet网络训练的实现,AlexNet由5个卷积层和3个全连接层组成,其中卷积层使用ReLU激活函数,全连接层使用Dropout技术来减少过拟合。网络的输入是224x224x3的RGB图像,输出是1000个类别的概率分布...
基于Python入侵检测IDS系统1.0 框架 html + css + jquery + python 3.9 + django+ scapy 抓包工具 winshark,etherDetect,sniffer python manage.py runserver 0.0.0.0:8000 用户类型 管理员 admin 123456 模块介绍...