Python 在 Anaconda 环境中安装 pydot 和 graphviz 包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27482170/
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
Installing pydot and graphviz packages in Anaconda environment
提问by gussilago
I want to be able to create graphical decision trees in Python, and I am currently trying to install both pydot
and graphviz
.
我希望能够在 Python 中创建图形决策树,并且我目前正在尝试同时安装pydot
和graphviz
.
I am using Anaconda as my environment (along with Spyder), and have tried to run the following lines of code
我使用 Anaconda 作为我的环境(以及 Spyder),并尝试运行以下代码行
conda install -c https://conda.binstar.org/t/TOKEN/j14r pydot
with the result
结果
Error: unknown host: http://repo.continuum.io/pkgs/pro/win-32/
Error: unknown host: http://repo.continuum.io/pkgs/free/win-32/
Error: unknown host: https://conda.binstar.org/t/TOKEN/j14r/win-32/
Error: No packages found matching: pydot
I have also tried using pip install pydot
and pip install graphviz
with similar results:
我也尝试使用pip install pydot
和pip install graphviz
类似的结果:
Downloading/unpacking pydot
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pydot
Cleaning up...
No distributions at all found for pydot
Storing complete log in [...]
I am getting pretty bored at trying to figure out how to go about this, so I was hoping anyone out there could give me some tips perhaps.
我在试图弄清楚如何解决这个问题时感到很无聊,所以我希望那里的任何人都可以给我一些提示。
Thanks
谢谢
回答by Aleksander Lidtke
I had the same issue and solved it by (order is important):
我遇到了同样的问题并通过(顺序很重要)解决了它:
- Installing
graphviz
, simply viasudo apt-get install graphviz
- Installing
graphviz
for Python via condasudo ~/anaconda2/bin/conda install graphviz
- Finally, by installing
pydot
using condasudo ~/anaconda2/bin/conda install pydot
- 安装
graphviz
,只需通过sudo apt-get install graphviz
graphviz
通过 conda安装Pythonsudo ~/anaconda2/bin/conda install graphviz
- 最后,通过
pydot
使用 conda安装sudo ~/anaconda2/bin/conda install pydot
This answer is overdue but this post helped me (together with this onethat mentions the installation order), so hopefully this answer will help someone else. I'm using Ubuntu 14.04 and Python 2.7.
这个答案是过期的,但是这个帖子(连同帮我这一个是提到的安装顺序),所以希望这个答案可以帮助别人。我使用的是 Ubuntu 14.04 和 Python 2.7。
P.S. apparently, there could be some issues with step 1 of the above algorithm, this postmentions how to fix them.
PS显然,上述算法的第1步可能存在一些问题,这篇文章提到了如何修复它们。
回答by Rexcirus
pip install pydotplus
conda install -c anaconda graphviz=2.38.0
(see here for latest versions https://anaconda.org/anaconda/graphviz)
(请参阅此处了解最新版本https://anaconda.org/anaconda/graphviz)
worked for me.
为我工作。
回答by Victor Ikechukwu Agughasi
Please see if this works for you...
请看看这是否适合你...
1) Open the "Anaconda Prompt" by simply pressing WINDOW + S (for Windows OS Users) and type CMD. Then Select accordingly.
1) 只需按 WINDOW + S(对于 Windows 操作系统用户)并键入 CMD,即可打开“Anaconda Prompt”。然后相应地选择。
2) Type the command "pip install pydot"
2) 输入命令“ pip install pydot”
3) Follow the onscreen information.
3) 按照屏幕上的信息进行操作。
NOTE: I'm using Conda version 4.3.21 and Python 3.6
注意:我使用的是 Conda 版本 4.3.21 和 Python 3.6
And Decision Tree Implementation below:
和下面的决策树实现:
回答by Ioannis Filippidis
回答by vivek anand
installing graphviz first and then installing pydotplus on mac, helped me. I was not able to install pydot through pip or conda or even through jupiter notebook. after installing, imported pydotplus(instead of usual pydot)
先安装graphviz,然后在mac上安装pydotplus,对我有帮助。我无法通过 pip 或 conda 甚至通过 jupiter notebook 安装 pydot。安装后,导入pydotplus(而不是通常的pydot)