I have installed graphviz
by trying pip install graphviz
. It said it had been successfully installed but I still got the ImportError: No module named graphviz
. BTW, I'm not running the program on Conda or Anaconda.
Asked
Active
Viewed 4,686 times
1

k3513662
- 69
- 2
- 9
-
Although I'm not using Conda, I also tried `conda install pip graphviz` and it still showed the same Error. – k3513662 Mar 15 '18 at 20:35
-
1Are you using a IDE like _Pycharm_? Because if you are, the default settings are to create a virtual environment for your project. Using pip will install the module globally but that won't affect your virtual environment. If that's the case, you might want to check this page: https://docs.python.org/3/tutorial/venv.html – frozencure Mar 15 '18 at 20:37
-
Which os are you using? – Xantium Mar 15 '18 at 20:44
-
1The same thing could happen if you are using multiple versions of python(2.7, 3.5). The module could be installed for only one of them and you are using the other one as the interpreter. In this case you should try doing `pip3 install graphviz` (if you are on a mac or linux) or changing the default interpreter if you are on windows. – frozencure Mar 15 '18 at 20:46
-
@frozencure I'm not using Pycharm this kind of IDE, I only edited with `Notepad++` and ran the program by `command line`. – k3513662 Mar 15 '18 at 20:46
-
@Simon I use Windows7. – k3513662 Mar 15 '18 at 20:47
-
Can you try importing graphviz directly in the command line and tell me if it works? Do the following: type in cmd `python`; then `import graphviz` and tell me what the output is – frozencure Mar 15 '18 at 20:54
-
Have you verified that the pip and python commands are referencing the same python install? – Matt Mar 15 '18 at 20:54
-
1@frozencure it worked! I think you are right about multiple versions. I am going to check the `Path` of `pip`. – k3513662 Mar 15 '18 at 21:05
1 Answers
-1
I had the same issue. The problem for me was the default python version that I was using for pip
. I fixed it using python3 -m pip install desired_package
.
Hope it solves your problem

mori_ahk
- 81
- 5