Python mechanize module not found

吃可爱长大的小学妹 提交于 2019-12-22 01:15:16

问题


My python version is: Python 2.7 I did an easy_install mechanize then I tried running a script and I'm getting this:

File "test.py", line 2, in <module>
import mechanize
ImportError: No module named mechanize

If you need any other information let me know.


回答1:


Try this in case pip or easy_install, for whatever reason, aren't working:

Download the source code from http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz

Unzip the package, go to the command line, change into the folder that was extracted and type:

python setup.py install

If you're on Linux/Mac, you may need to type the following:

sudo python setup.py install



回答2:


Would like to add something for some future users:

In case some of the users get the error "No module named '_version'" Mechanize however doesn't support Python 3 so you should install a Python 2.x release (the latest available is 2.7.3), install the mechanize package there and then retry running your script.



来源:https://stackoverflow.com/questions/14543213/python-mechanize-module-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!