I had a similar issue that I resolved and here is my issue:
I set everything up on python3 but I was using python to call my file for example: I was typing "python mnist.py" ...since I have everything on python3 it was thinking I was trying to use python 2.7
The correction: "python3 mnist.py" - the 3 made all the difference
I'm by no means an expert in python or pip, but there is definitely a difference between pip and pip3 (pip is tied to python 2.7) (pip3 is tied to python 3.6)
so when installing for 2.7 do: pip install when installing for 3.6 do: pip3 install
and when running your code for 2.7 do: python when running your code for 3.6 do: python3
I hope this helps someone!