问题
I want to draw a decision tree with python3. Yet I can only find modules for python2: graphviz
, ete3
Did I miss something? Can I use them with python3? Do you know any other possibilities?
I use Ubuntu 14.04.
Edit:
I tried the command sudo python3 -m pip install graphviz
, but it still can't find the module.
回答1:
According to Graphviz's PyPI page, it is available for Python 3.
On Ubuntu make sure you have graphviz with:
sudo apt-get install python3-pygraphviz
Perhaps Python3 can't find your installed graphviz? Did you install it with, e.g.
python3 -m pip install graphviz
On Ubuntu you might try:
sudo apt-get install python3-pip
pip3 install graphviz
You haven't told us what your system is, which may affect the advice you are given.
If you're on Windows, I usually recommend installing Anaconda and using its package manager (it comes with almost all the things, but not graphviz so you'd have to use its package manager to install, but I'd expect it to work out of the gate once you did install it).
If you're on Mac or Linux, try installing with the command I gave above (or whatever your Python 3 executable uses.)
来源:https://stackoverflow.com/questions/36604310/trouble-installing-graphviz-for-python3-on-ubuntu-14-04