日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

我的pygraphviz安装之路

發(fā)布時(shí)間:2025/4/14 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 我的pygraphviz安装之路 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

近來(lái),在學(xué)習(xí)python的數(shù)據(jù)挖掘,需要安裝pygraphviz,與諸多麻煩:

注:我的系統(tǒng)是fedora 17beta版;python2.7.3

1、我首先直接安裝pygraphviz(easy_install),提示錯(cuò)誤:

1) You don't have Graphviz installed:
Install Graphviz (http://graphviz.org)

2) Your Graphviz package might incomplete.
Install the binary development subpackage (e.g. libgraphviz-dev or similar.)

3) You are using Windows
There are no PyGraphviz binary packages for Windows but you might be
able to build it from this source. See
http://networkx.lanl.gov/pygraphviz/reference/faq.html

2、按照以上錯(cuò)誤提示,我先安裝了Graphviz(yum install graphviz),木牛問(wèn)題;

3、接著再試著安裝libgraphviz-dev,安裝失敗;

4、轉(zhuǎn)而使用pip安裝,出現(xiàn)如下錯(cuò)誤:

Your graphviz installation could not be found.Either the graphviz package is missing on incomplete (binary packages graphviz-dev or graphviz-devel missing?).If you think your installation is correct you will need to manually change the include_path and library_path variables in setup.py to point to the correct locations of your graphviz installation.The current setting of library_path and include_path is: library_path=None include_path=Noneerror: None

使用pip安裝和easy_install所不同的是,其在主文件夾中會(huì)出現(xiàn)一個(gè)bulid文件夾,pygraphviz文件被下載緩存在此;

5、于是,修改pygraphviz文件夾中的setup.py文件夾,我使用的是vi;

在其中可以看到:

from glob import glob

import os

import sys

if os.path.exists('MANIFEST'): os.remove('MANIFEST')

?

from distutils.core import setup, Extension

?

from setup_extra import pkg_config, dotneato_config

?

if sys.argv[-1] == 'setup.py':

? ? print "To install, run 'python setup.py install'" //這個(gè)我們接下來(lái)會(huì)用到的;

? ? print

?

if sys.version_info[:2] < (2, 4):

? ? print "PyGraphviz requires Python version 2.4 or later (%d.%d detected)." % \

? ? ? ? ? sys.version_info[:2]

? ? sys.exit(-1)

?

library_path=None

include_path=None

?上面這兩行需要注釋掉

# If the setup script couldn't find your graphviz installation you can

# specify it here by uncommenting these lines or providing your own:

# You must set both 'library_path' and 'include_path'

?

# Linux, generic UNIX

#library_path='/usr/lib/graphviz'

#include_path='/usr/include/graphviz'

?

# OSX, Linux, alternate location

#library_path='/usr/local/lib/graphviz'

#include_path='/usr/local/include/graphviz'

?上面這兩行需要取消注釋

# OSX (Fink)

#library_path='/sw/lib/graphviz'

#include_path='/sw/include/graphviz'

?

# OSX (MacPorts)

#library_path='/opt/local/lib/graphviz'

#include_path='/opt/local/include/graphviz'

?

# Windows

# Unknown

?

# Attempt to find Graphviz installation

if library_path is None and include_path is None:

? ? print "Trying pkg-config"

? ? include_path,library_path=pkg_config()

?

if library_path is None and include_path is None:

? ? print "Trying dotneato-config"

? ? include_path,library_path=dotneato_config()

?

if library_path is None or include_path is None:

? ? print?

? ? print ?"""Your Graphviz installation could not be found.

?

1) You don't have Graphviz installed:

? ?Install Graphviz (http://graphviz.org)

?

2) Your Graphviz package might incomplete.

? ?Install the binary development subpackage (e.g. libgraphviz-dev or similar.)

?

3) You are using Windows

? ?There are no PyGraphviz binary packages for Windows but you might be

? ?able to build it from this source. ?See

? ?http://networkx.lanl.gov/pygraphviz/reference/faq.html

這個(gè)不就是之前的錯(cuò)誤提示么??

If you think your installation is correct you will need to manually

change the include_path and library_path variables in setup.py to

point to the correct locations of your graphviz installation.

6、按照上述操作進(jìn)行修改,之后運(yùn)行?python setup.py install,但是依然出現(xiàn)錯(cuò)誤:“gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fs………………”?

7、應(yīng)該是gcc包缺失,于是乎,繼續(xù)安裝gcc;使用yum install gcc,出現(xiàn)錯(cuò)誤——一些依賴包無(wú)法安裝;

8、判斷可能是某些包版本不夠新,升級(jí)之(update-testing)

9、升級(jí)完之后,在安裝pygraphviz,出現(xiàn)錯(cuò)誤:“致命錯(cuò)誤,python.h沒(méi)有這個(gè)文件或目錄。”

10、然后,安裝包“python-dev”(yum install python-devel);

11、easy_install 安裝,成功。import?pygraphviz,沒(méi)有報(bào)錯(cuò),OK!

轉(zhuǎn)載于:https://www.cnblogs.com/atricfox/archive/2012/05/12/2497421.html

總結(jié)

以上是生活随笔為你收集整理的我的pygraphviz安装之路的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。