I am trying to create a very simple Python 3.6 script. Using MacOS.
For this script I had to install robobrowser, which I installed with easy_install robobrowser
. After that I try to import it with the following statements:
import re
from robobrowser import RoboBrowser
However, terminal prompted me with the following (infamous) error:
Traceback (most recent call last):
File "signup.py", line 2, in <module>
from robobrowser import RoboBrowser
ModuleNotFoundError: No module named 'robobrowser'
I have installed Python 3.6. However, in my /Library/Python I only have 2 folders: 2.6 and 2.7. In /Library/Python/site-packages there is a folder named robobrowser-0.5.3-py2.7.egg. Might it have something to do with this?
Sorry for asking a most likely easy question. I can however not seem to figure it out.
Thanks for reading this,
Thijmen.
Probably you are using
easy_install
for Python2. The best solution is to install pip for Python3 and runpip install robobrowser
This must be because you have multiple versions of Python installed, and when you installed robobrowser, it got installed to a different python version than the one you are trying to use. If you want to use it with Python 3, make your $PATH variable use the Python3's Scripts path instead of the one from Python2. Or a simpler way is to install pip3 on your computer and do
sudo pip3 install robobrowser
For reference: changing python path on mac?
You can run the
which python
,which python3
andwhich easy_install
commands in your terminal to find which versions of python and easy_install are being used by default.