0

I've installed pydot and checked to make sure of this several times. However, when I attempt to import it in a Juptyer notebook file, I keep receiving a Module Not Found error:

ModuleNotFoundError: No module named 'pydot'

When I run pip3 show pydot, I get the following response:

Name: pydot
Version: 1.4.2
Summary: Python interface to Graphviz's Dot
Home-page: https://github.com/pydot/pydot
Author: Ero Carrera
Author-email: ero.carrera@gmail.com
License: MIT
Location: /Users/parkertemple/Library/Python/3.8/lib/python/site-packages
Requires: pyparsing
Required-by: 

After, when I run

 python3 myscript.py

I get this:


/usr/local/bin/python3: can't open file '/Users/(my user account)/script.py': [Errno 2] No such file or directory

I'm relatively new to the command line and am struggling a bit. Any help would be greatly appreciated.

I'm using mac os. Thank you so much!

1 Answers1

0

It's not uncommon to have these problems when starting out. Usually this problem relates to Python3 not understanding where the pip directory is making its installations.

Two paths you can consider in fixing this issue:

  1. For Python 3.7 (try replacing it with your python3 version):

    export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python3.7/site-packages:/usr/lib/python3.7/site-packages"

  2. Use a Python virtual environment. This is like making a specific python & pip installation. It's particularly useful because it isolates the modules that your project needs, making it more lightweight, shareable, etc. This will take a little more time to set up; but it can be very important to understand why virtual environments are beneficial to your project.

Hunter G
  • 29
  • 4