Importerror: No Module Named '_version' When Importing Mechanize
I installed mechanize via pip and get an errer when I import the module: $ python Python 3.5.2 (default, Jun 28 2016, 08:46:01) [GCC 6.1.1 20160602] on linux Type 'help', 'copyrig
Solution 1:
If you look at setup.py
you'll see mechanize
is a Python 2.x
package:
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.4
Programming Language :: Python :: 2.5
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Apart from that, you can see in mechanize/__init__.py
that all imports are relative:
from _version import __version__
instead of explicit:
from ._versionimport __version__
In python 3, this results in import errors.
There's an issue opened for Py3
support and it lists some alternatives you could try. That, or port it :-).
Solution 2:
it't work for me, coppy file _version to use this command
cp -R __version /usr/local/lib/python3.9
to determine pac
Post a Comment for "Importerror: No Module Named '_version' When Importing Mechanize"