【问题标题】:How to install graphviz on Debian 7.7?如何在 Debian 7.7 上安装 graphviz?
【发布时间】:2017-01-17 05:44:36
【问题描述】:

我是编程新手。我刚刚安装了我的 Debian 并安装了以下软件包

dpkg -l | grep graph
ii  graphviz                           2.26.3-14+deb7u2              amd64        rich set of graph drawing tools
ii  libart-2.0-2:amd64                 2.3.21-2                      amd64        Library of functions for 2D graphics - runtime files
ii  libcairo2:amd64                    1.12.2-3                      amd64        The Cairo 2D vector graphics library
ii  libcdt4                            2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - cdt library
ii  libcgraph5                         2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - cgraph library
ii  libgraph4                          2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - graph library
ii  libgraphviz-dev                    2.26.3-14+deb7u2              amd64        graphviz libs and headers against which to build applications
ii  libgvc5                            2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - gvc library
ii  libgvpr1                           2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - gvpr library
ii  libpathplan4                       2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - pathplan library
ii  libxdot4                           2.26.3-14+deb7u2              amd64        rich set of graph drawing tools - xdot library
ii  openssl                            1.0.1e-2+deb7u12              amd64        Secure Socket Layer (SSL) binary and related cryptographic tools

我还使用以下程序从 Graphviz 开始:

<?php
require_once 'Image/GraphViz.php';

$gv = new Image_GraphViz();
$gv->addEdge(array('wake up'        => 'visit bathroom'));
$gv->addEdge(array('visit bathroom' => 'make coffee'));
$gv->image();
?>

但我得到的是:

addEdge(array('wake up' => 'visit bathroom')); $gv->addEdge(array('visit bathroom' => 'make coffee')); $gv->image(); ?>

请告诉我如何处理这个问题?

问候

【问题讨论】:

    标签: php linux installation debian graphviz


    【解决方案1】:

    您需要为 GraphViz 安装 PHP 绑定。我没有 Debian 映像可以尝试,但请尝试:

    sudo apt-get install libgv-php5
    

    如果这不起作用,请尝试:

    sudo apt-cache search libgv | grep -i php
    

    更新:在执行以下命令后,上面给出的代码适用于干净的 Debian 7 映像:

    sudo apt-get update
    sudo apt-get install apache2 libapache2-mod-php5 libgv-php5 graphviz vim php-pear
    sudo pear install Image_GraphViz
    
    # Copy the file above to test.php
    php5 test.php
    

    【讨论】:

    • 您确定 PHP 工作正常吗?如果您将该文件替换为:&lt;?php echo "Hello." ?&gt;,您是否只看到Hello.
    • 抱歉,搞错了。 Image/GraphViz.php 是 PEAR 包的一部分。试试pear install Image_GraphViz
    • 成功了!谢谢
    猜你喜欢
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 2017-12-18
    • 2020-05-29
    • 2021-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多