Python 如何使用 conda 安装 pydot?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26349314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 00:22:42  来源:igfitidea点击:

How can I use conda to install pydot?

pythonanacondacondapydot

提问by joe

Trying to generate some PDF's of decision trees by following some of the sklearn documentation, but can't get Pydot on my machine. Is there any way to use the conda installer to install the pydot package? Based on the command line errors I'm seeing, it may be a 64bit issue. I use binstar search to find the package channel:

试图通过遵循一些 sklearn 文档来生成一些决策树的 PDF文件,但无法在我的机器上获取 Pydot。有什么办法可以使用conda安装程序来安装pydot包吗?根据我看到的命令行错误,它可能是 64 位问题。我使用 binstar 搜索来查找包频道:

C:\binstar search -t conda 

Which gives the recommendation of looking at the packages in detail using

这给出了使用详细查看包的建议

binstar show j14r/pydot

Which then tells me to

然后告诉我

conda install --channel https://conda.binstar.org/j14r pydot

But when I run the conda install command, I get the following error (same error for all the pydot packages listed):

但是当我运行 conda install 命令时,我收到以下错误(列出的所有 pydot 包都出现相同的错误):

Fetching package metadata: ...
Error: No Packages found in current win-64 channels matching: pydot
You can search for this package with 

binstar search t conda pydot

which sends me back to the beginning of this all. Any ideas? Thanks all.

这让我回到了这一切的开始。有任何想法吗?谢谢大家。

采纳答案by Rajesh Kumar Raj

This may help for someone who is looking for For Anaconda on Windows 10 64 Bit, Environment: Windows 10 64 Bit, Python 3.5.2, Anaconda 4.2.0 (64-bit)

这可能对在 Windows 10 64 位上寻找 Anaconda 的人有所帮助,环境:Windows 10 64 位、Python 3.5.2、Anaconda 4.2.0(64 位)

  1. Download "graphviz-2.38.msi" from https://graphviz.gitlab.io/_pages/Download/Download_windows.html
  2. Execute the "graphviz-2.38.msi" file
  3. Add the graphviz bin folder to the PATH system environment variable (Example: "C:\Graphviz2.38\bin")
  4. Go to Anaconda Prompt using start menu (Make sure to right click and select "Run as Administrator". We may get permission issues if Prompt as not opened as Administrator)
  5. Execute the command: conda install graphviz
  6. Execute the command: pip install git+https://github.com/nlhepler/pydot.git
  7. Execute the command "conda list" and make sure pydot and graphviz modules are listed. Thanks
  1. https://graphviz.gitlab.io/_pages/Download/Download_windows.html下载“graphviz-2.38.msi”
  2. 执行“graphviz-2.38.msi”文件
  3. 将graphviz bin文件夹添加到PATH系统环境变量中(例如:“C:\Graphviz2.38\bin”)
  4. 使用开始菜单转到 Anaconda Prompt(确保右键单击并选择“以管理员身份运行”。如果提示未以管理员身份打开,我们可能会遇到权限问题)
  5. 执行命令:conda install graphviz
  6. 执行命令:pip install git+ https://github.com/nlhepler/pydot.git
  7. 执行命令“conda list”并确保列出了 pydot 和 graphviz 模块。谢谢

回答by asmeurer

It looks like the j14r pydot package is built for 32-bit Windows, but I'm guessing you are using the 64-bit conda. See https://conda.binstar.org/j14r.

看起来 j14r pydot 包是为 32 位 Windows 构建的,但我猜你正在使用 64 位 conda。请参阅https://conda.binstar.org/j14r

回答by Javier Granado

Try running the following:

尝试运行以下命令:

conda install -c https://conda.binstar.org/sstromberg pydot

回答by MarkTab www.marktab.net

I had the same question for my Anaconda3 x64 installation on Windows 8.1.

我在 Windows 8.1 上安装 Anaconda3 x64 时遇到了同样的问题。

Here is what I did:

这是我所做的:

1) Installed Github for Windows https://windows.github.com/

1) 为 Windows 安装 Github https://windows.github.com/

2) Opened the Git Shell (which is a PowerShell session that allows git commands)

2)打开Git Shell(这是一个允许git命令的PowerShell会话)

3) Install the pydot from https://github.com/nlhepler/pydotwith this command:

3)使用以下命令从https://github.com/nlhepler/pydot安装 pydot :

./pip install git+https://github.com/nlhepler/pydot.git

4) You can check whether pydot was installed by issuing

4)您可以通过发出来检查是否安装了pydot

conda list

回答by njjnex

New pydotlink for 64-bit installer https://anaconda.org/rmg/pydotor just

64 位安装程序的新pydot链接https://anaconda.org/rmg/pydot或只是

conda install -c rmg pydot

conda install -c rmg pydot

回答by tony_tiger

Try this (from Anaconda Prompt):

试试这个(来自 Anaconda Prompt):

conda install pydot-ng

Then, in your code:

然后,在您的代码中:

try:
    import pydot_ng as pydot
except ImportError:
    import pydot # if someone running with old installation

More about Pydot-ng

更多关于Pydot-ng

回答by dataLeo

Most of the people gave great insights, here's a procedure which I find useful for myself -

大多数人都给出了很好的见解,这是我认为对自己有用的程序-

assumed conf. -> Anaconda 4.4.0 or higher, Win 8+, and using anaconda prompt

假设 conf。-> Anaconda 4.4.0 或更高版本,Win 8+,并使用 anaconda prompt

  • Few required installations (no order necessary)
    1. pip install pydot-ng
    2. conda install graphviz
    3. pip install graphviz
  • PATH setting -> Under user environment variables add C:/Anaconda/Library/bin/graphvizin PATH (not Path)
  • Go to C:/Anaconda/Lib/site-packages/keras/utils/
    Now open vis_utils.pyin an editor and change line 11 from import pydotto import pydot_ng as pydot
  • All set, now go to Jupyter notebook and type following commands -
    import graphviz
    import pydot_ng as pydot
    pydot.find_graphviz()
    If everything went well then you will find something similar to as shown below -
    {'circo': 'C:\\Anaconda\\Library\\bin\\graphviz\\circo.exe',
    'dot': 'C:\\Anaconda\\Library\\bin\\graphviz\\dot.exe',
    'fdp': 'C:\\Anaconda\\Library\\bin\\graphviz\\fdp.exe',
    'neato': 'C:\\Anaconda\\Library\\bin\\graphviz\\neato.exe',
    'sfdp': 'C:\\Anaconda\\Library\\bin\\graphviz\\sfdp.exe',
    'twopi': 'C:\\Anaconda\\Library\\bin\\graphviz\\twopi.exe'}
  • 很少需要安装(无需订购)
    1. pip install pydot-ng
    2. conda install graphviz
    3. pip install graphviz
  • PATH 设置 -> 在用户环境变量下添加C:/Anaconda/Library/bin/graphvizPATH(不是 Path)
  • 转到C:/Anaconda/Lib/site-packages/keras/utils/
    Now open vis_utils.pyin an editor 并将第 11 行从 更改import pydotimport pydot_ng as pydot
  • 一切就绪,现在转到 Jupyter notebook 并键入以下命令 -
    import graphviz
    import pydot_ng as pydot
    pydot.find_graphviz()
    如果一切顺利,那么您会发现类似于如下所示的内容 -
    {'circo': 'C:\\Anaconda\\Library\\bin\\graphviz\\circo.exe',
    'dot': 'C:\\Anaconda\\Library\\bin\\graphviz\\dot.exe',
    'fdp': 'C:\\Anaconda\\Library\\bin\\graphviz\\fdp.exe',
    'neato': 'C:\\Anaconda\\Library\\bin\\graphviz\\neato.exe',
    'sfdp': 'C:\\Anaconda\\Library\\bin\\graphviz\\sfdp.exe',
    'twopi': 'C:\\Anaconda\\Library\\bin\\graphviz\\twopi.exe'}