Reputation: 541
I am using the Anaconda 2.1.0 distribution of Python on Windows 8.
python --version Python 3.4.1 :: Anaconda 2.1.0 (64-bit)
I used pip to install the mechanize package. pip (v 6.0.8) installed mechanize 0.2.5 which is the most recent release.
But, while trying to import the package, python throws an error:
>>> import mechanize Traceback (most recent call last): File "", line 1, in File "C:\Anaconda3\lib\site-packages\mechanize\__init__.py", line 122, in from _mechanize import \ ImportError: No module named '_mechanize'
Similar questions here received replies to check if the installation was done on the PYTHONPATH
.
I also checked sys.path
and there seems to be no problem there.
>>> import sys >>> sys.path ['', 'C:\\Anaconda3\\Scripts', 'C:\\Anaconda3\\lib\\site-packages\\cssselect-0.9.1-py3.4.egg', 'C:\\Anaconda3', 'C:\\Anaconda3\\python34.zip', 'C:\\Anaconda3\\DLLs', 'C:\\Anaconda3\\lib', 'C:\\Anaconda3\\lib\\site-packages', 'C:\\Anaconda3\\lib\\site-packages\\Sphinx-1.2.3-py3.4.egg', 'C:\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Anaconda3\\lib\\site-packages\\runipy-0.1.1-py3.4.egg', 'C:\\Anaconda3\\lib\\site-packages\\setuptools-12.2-py3.4.egg', 'C:\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\UserName\\.ipython']
I am able to import other packages residing in the same directory, for e.g. numpy.
Am I missing something?
Upvotes: 3
Views: 2381
Reputation: 541
Thanks Joe for pointing that out.
Mechanize is not supported for Python 3.x.
For my job, I set up a new Python 2.7 environment through conda
and switched to it. It addressed the issue.
Upvotes: 1