I apologize for a newbie Python question.
I have a script that has
import mechanize
which gives the error:
File "/usr/local/lib/python3.5/dist-packages/mechanize/__init__.py", line 122, in <module> from _mechanize import \
ImportError: No module named '_mechanize'
I would think this means the module isn't installed or initialized, but when I open a BASH and type:
$ pip3.5 install mechanize
...this gives the error
Requirement already satisfied: mechanize in /usr/local/lib/python3.5/dist-packages
I looked here and here. The latter comes close, but I think I'm using the right pip edition.
Sorry for what I'm sure is awful newbie nomenclature. I suspect there's a difference between mechanize and _mechanize, but I don't know what it is.
General suggestion: You should be using virtual environments
as this prevents problems in packages by containing the packages within each virtual env. Far easier to maintain python module versions in this manner.
On a normal PC you may be able to fix your problem like this (but it won't work on PythonAnywhere):
cd /usr/local/lib/python3.5/dist-packages/mechanize/
python setup.py install
then attempt to import again.
If that fails then try to do the following
pip uninstall mechanize
pip install mechanize