如何在Python3.6上使用conda或pip安装pygraphviz?
我不知道在这里该做什么,但我确实需要使用如何在Python3.6上使用conda或pip安装pygraphviz?,python,pip,clang,graphviz,pygraphviz,Python,Pip,Clang,Graphviz,Pygraphviz,我不知道在这里该做什么,但我确实需要使用graphviz布局和networkx 我是按照安装过程中的特定方式进行的,当找不到graphviz时: 找不到您的Graphviz安装 1) You don't have Graphviz installed: Install Graphviz (http://graphviz.org) 2) Your Graphviz package might incomplete. In
graphviz
布局和networkx
我是按照安装过程中的特定方式进行的,当找不到graphviz
时:
找不到您的Graphviz安装
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
If you think your installation is correct you will need to manually
provide path to graphviz include and library. For example:
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
The current setting of library_dirs and include_dirs is:
library_dirs=None
include_dirs=None
error: Error locating graphviz.
这是我的python
版本:
(py3_testing) jespinozlt-osx:~ jespinoz$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
这是我的Mac上的OS
版本:
(py3_testing) jespinozlt-osx:~ jespinoz$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G1217
我确保安装了graphviz
:
(py3_testing) jespinozlt-osx:~ jespinoz$ ls -l ~/anaconda/envs/py3_testing/include/| grep "graphviz"
drwxr-xr-x 29 jespinoz tigr 986 Jun 6 12:51 graphviz
(py3_testing) jespinozlt-osx:~ jespinoz$ ls -l ~/anaconda/envs/py3_testing/lib/| grep "graphviz"
drwxr-xr-x 18 jespinoz tigr 612 Jun 6 12:51 graphviz
现在,当我尝试通过pip
安装时:
(py3_testing) jespinozlt-osx:~ jespinoz$ pip install pygraphviz --install-option="--include-path=~/anaconda/envs/py3_testing/include/graphviz/" --install-option="--library-path=~/anaconda/envs/py3_testing/lib/graphviz"
/Users/jespinoz/anaconda/envs/py3_testing/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting pygraphviz
Using cached https://files.pythonhosted.org/packages/98/bb/a32e33f7665b921c926209305dde66fe41003a4ad934b10efb7c1211a419/pygraphviz-1.3.1.tar.gz
Skipping bdist_wheel for pygraphviz, due to binaries being disabled for it.
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz ... error
Complete output from command /Users/jespinoz/anaconda/envs/py3_testing/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-_hho1hi2/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-v2gpw_h3-record/install-record.txt --single-version-externally-managed --compile --include-path=~/anaconda/envs/py3_testing/include/graphviz/ --library-path=~/anaconda/envs/py3_testing/lib/graphviz:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/pygraphviz
x86_64-apple-darwin13.4.0-clang -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I~/anaconda/envs/py3_testing/include/graphviz/ -I/Users/jespinoz/anaconda/envs/py3_testing/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.6/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found
#include "graphviz/cgraph.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1
----------------------------------------
Command "/Users/jespinoz/anaconda/envs/py3_testing/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-_hho1hi2/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-v2gpw_h3-record/install-record.txt --single-version-externally-managed --compile --include-path=~/anaconda/envs/py3_testing/include/graphviz/ --library-path=~/anaconda/envs/py3_testing/lib/graphviz" failed with error code 1 in /private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-build-_hho1hi2/pygraphviz/
我安装了自制软件:
(python3) jespinozlt-osx:anaconda jespinoz$ ls /usr/local/Cellar/graphviz/2.40.1/include/graphviz/
(python3) jespinozlt-osx:anaconda jespinoz$ ls /usr/local/Cellar/graphviz/2.40.1/lib/
graphviz/ libcdt.dylib libcgraph.dylib libgvc.dylib libgvpr.dylib liblab_gamut.dylib libpathplan.dylib libxdot.dylib
libcdt.5.dylib libcgraph.6.dylib libgvc.6.dylib libgvpr.2.dylib liblab_gamut.1.dylib libpathplan.4.dylib libxdot.4.dylib pkgconfig/
(python3) jespinozlt-osx:anaconda jespinoz$ ls /usr/local/Cellar/graphviz/2.40.1/lib/graphviz/
config6 libgvplugin_core.dylib libgvplugin_dot_layout.dylib libgvplugin_gd.dylib libgvplugin_neato_layout.dylib libgvplugin_quartz.dylib
libgvplugin_core.6.dylib libgvplugin_dot_layout.6.dylib libgvplugin_gd.6.dylib libgvplugin_neato_layout.6.dylib libgvplugin_quartz.6.dylib tcl
(python3) jespinozlt-osx:anaconda jespinoz$ pip install pygraphviz --install-option="--include-path=/usr/local/Cellar/graphviz/2.40.1/include/graphviz/" --install-option="--library-path=/usr/local/Cellar/graphviz/2.40.1/lib/graphviz"
/Users/jespinoz/anaconda/envs/python3/lib/python3.6/site-packages/pip/_internal/commands/install.py:199: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting pygraphviz
Using cached https://files.pythonhosted.org/packages/98/bb/a32e33f7665b921c926209305dde66fe41003a4ad934b10efb7c1211a419/pygraphviz-1.3.1.tar.gz
Skipping bdist_wheel for pygraphviz, due to binaries being disabled for it.
mxnet 1.1.0 has requirement numpy<=1.13.3, but you'll have numpy 1.14.2 which is incompatible.
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz ... error
Complete output from command /Users/jespinoz/anaconda/envs/python3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-install-2d1lydtv/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-record-adm5qrum/install-record.txt --single-version-externally-managed --compile --include-path=/usr/local/Cellar/graphviz/2.40.1/include/graphviz/ --library-path=/usr/local/Cellar/graphviz/2.40.1/lib/graphviz:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/pygraphviz
x86_64-apple-darwin13.4.0-clang -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/usr/local/Cellar/graphviz/2.40.1/include/graphviz/ -I/Users/jespinoz/anaconda/envs/python3/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.6/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found
#include "graphviz/cgraph.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1
----------------------------------------
Command "/Users/jespinoz/anaconda/envs/python3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-install-2d1lydtv/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-record-adm5qrum/install-record.txt --single-version-externally-managed --compile --include-path=/usr/local/Cellar/graphviz/2.40.1/include/graphviz/ --library-path=/usr/local/Cellar/graphviz/2.40.1/lib/graphviz" failed with error code 1 in /private/var/folders/6z/5vbtz_gmkr76ftgc3149dvtr0003c0/T/pip-install-2d1lydtv/pygraphviz/
(python3)jespinozlt osx:anaconda jespinoz$ls/usr/local/cillar/graphviz/2.40.1/include/graphviz/
(蟒蛇3)jespinozlt osx:anaconda jespinoz$ls/usr/local/cillar/graphviz/2.40.1/lib/
graphviz/libcdt.dylib libcgraph.dylib libgvc.dylib libgvpr.dylib liblab_gamu.dylib libpathplan.dylib libxdot.dylib
libcdt.5.dylib libcgraph.6.dylib libgvc.6.dylib libgvpr.2.dylib liblab_gamut.1.dylib libpathplan.4.dylib libxdot.4.dylib pkgconfig/
(蟒蛇3)jespinozlt osx:anaconda jespinoz$ls/usr/local/cillar/graphviz/2.40.1/lib/graphviz/
配置6 libgvplugin_core.dylib libgvplugin_dot_layout.dylib libgvplugin_gd.dylib libgvplugin_neato_layout.dylib libgvplugin_quartz.dylib
libgvplugin_core.6.dylib libgvplugin_dot_layout.6.dylib libgvplugin_gd.6.dylib libgvplugin_neato_layout.6.dylib libgvplugin_quartz.6.dylib tcl
(python3)jespinozlt osx:anaconda jespinoz$pip install pygraphviz--install option=“--include path=/usr/local/cillar/graphviz/2.40.1/include/graphviz/”--install option=“--library path=/usr/local/cillar/graphviz/2.40.1/lib/graphviz”
/Users/jespinoz/anaconda/envs/python3/lib/python3.6/site packages/pip/_internal/commands/install.py:199:UserWarning:由于使用--build options/--global options/--install options,禁用所有控制盘的使用。
cmdoptions.检查\u安装\u构建\u全局(选项)
收集pygraphviz
使用缓存https://files.pythonhosted.org/packages/98/bb/a32e33f7665b921c926209305dde66fe41003a4ad934b10efb7c1211a419/pygraphviz-1.3.1.tar.gz
正在跳过pygraphviz的bdist_控制盘,因为它禁用了二进制文件。
mxnet 1.1.0要求numpy使用以下命令行(您需要):
终于让它工作了:
# PyGraphViz
conda install graphviz --yes
pip download git+git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz
unzip pygraphviz*.zip
cd pygraphviz
python setup.py install --include-path=$CONDA_PREFIX/include --library-path=$CONDA_PREFIX/lib
pip install pydot
您是否有~/anaconda/envs/py3_测试/include/graphviz/cgraph.h
?尝试pip安装pygraphviz--install option=“--include path=~/anaconda/envs/py3_testing/include”-install option=“--library path=~/anaconda/envs/py3_testing/lib”
(最后没有graphviz
),它解决了我在MacOS上尝试的问题。在最后一行的第二行,我遇到了这个错误:python:无法打开文件'setup.py':[Errno 2]没有这样的文件或目录
phd
在实际问题中的注释,解决了我的问题。谢谢
# PyGraphViz
conda install graphviz --yes
pip download git+git://github.com/pygraphviz/pygraphviz.git#egg=pygraphviz
unzip pygraphviz*.zip
cd pygraphviz
python setup.py install --include-path=$CONDA_PREFIX/include --library-path=$CONDA_PREFIX/lib
pip install pydot