当前位置:网站首页>Installation of third-party library iGraph for social network visualization

Installation of third-party library iGraph for social network visualization

2022-06-26 00:04:00 Falling ink painting snow

win10 install igragh Super detailed steps

First Python_igraph It is a kind of harmony. nextworkx. The same kind of visual library for drawing graphics of complex networks , And it's an external library , Don't support direct pip Direct download ,
So you must download and import from the outside . It has to be said that most of the installation packages on the Internet are in linux In the environment , And it only supports python2 Of , I am installing on the computer win64
It really cost me a lot in the environment 24 Finally, the environment was successfully installed within hours , Including the collection of relevant
Documentation and installation , It takes the most time to find the required documents , Well, there's no more bullshit , Direct installation process :
Environmental Science :win10 bit64 python Platform is anaconda3, That is, where I want to install anaconda3 In the environment , Of course, it can also be in the corresponding Python Under the interpreter , It is shown here in conda Installation below .
Installation is required first pycairo This bag goes to anacon Environment directory ( It is recommended to check whether the package has been installed on the terminal pip list, If so, download directly igraph The module can ), It is suggested that https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymetis Look here ,
This is a special needle for win A large number of installation packages in the environment , Be sure to use google browser , Other browsers will appear when they open and download the corresponding package 404 error , And when you enter the selection page , Choose the file corresponding to your environment to download , For example, mine is python3.7,win64 Environmental Science , So the choice is pycairo-1.18.1-CP37-cp37m-win_amd64.whlcp37 That's the corresponding python3.7 edition , It will then be downloaded automatically ,
After downloading , Select terminal cmd Input pip install + Absolute path + The one above pycairo-1.18.1-CP37-cp37m-win_amd64.whl, Because of the
yes anaconda, So choose anaconda3- prompt terminal - Tap on the terminal pip install C:\Users\Administrator\Desktop\pycairo-1.18.1-cp37-cp37m-win_amd64.whl
( As for not knowing how to look at the absolute path , You can right-click properties , My method is to drag this file to any python Environment , For example, I use VScode, Right click on the , There will be replication paths )
Then wait for the installation to succeed , Then , Then download it from the website above python_igraph,python_igraph-0.7.1.post6-CP37-cp37m-win_amd64.whl
Then install the command and pycairo equally . Finally, we need 6 A file is added to your python Environment ,( If the computer has been installed before pycairo, You can skip looking for this 6 File ) Yours python_igraph To be complete , Be able to draw and visualize normally .
then Go to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ Get the required files :
cairo_1.8.10-3_win32.zip
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)
zlib (zlib_1.2.5-2_win32.zip).
Then download this 6 After extracting the compressed files, you will get 6 A folder , Find... In it 6 individual .dll file :
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).
Finally, I will 6 individual .dll Files are placed in the installation pycairo In the file generated by Lib\site-packages(pycairo Folder name ) For example, my position is ( For example, once my computer has been installed, I can't find the following address , There is another one that can find this address without installation )C:\Users\Administrator\Anaconda3\Lib\site-packages\pycairo-1.18.1.dist-info
Here we are , Whole igraph The external package installation is completed , The following code can be used to verify :

from igraph import *
g = Graph([(0,1),(0,2),(2,3),(3,4),(4,2)])
Layout = g.layout('kk')
plot(g,Layout = Layout)

The results are shown as follows
Alt

原网站

版权声明
本文为[Falling ink painting snow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206252107243156.html