继续困扰与我的Ubuntu 12.04机器上的python(2.7.3)安装和导入模块。
在这里我有一个问题,我已经绝对安装机械化在我的机器和在各种虚拟环境。
我试过安装从pip,easy_install和通过python setup.py安装从这个repo:https://github.com/abielr/mechanize。
无效,每次,我输入我的python互动,我得到:
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named mechanize
>>>
其他计算机我安装这个没有问题(一个mac,或Windows机器在工作,例如,一切都很好,安装和导入像正常)。
这在很大程度上使我疯狂,只是想做一些工作。
UPDATE INFO(响应评论):
输出easy_install机械化和路径:
@:~$ sudo easy_install mechanize
[sudo] password for :
Processing mechanize
Writing /home//mechanize/setup.cfg
Running setup.py -q bdist_egg --dist-dir /home//mechanize/egg-dist-tmp-zXwJ_d
warning: no files found matching '*.html' under directory 'docs'
warning: no files found matching '*.css' under directory 'docs'
warning: no files found matching '*.js' under directory 'docs'
mechanize 0.2.6.dev-20130112 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.7/dist-packages/mechanize-0.2.6.dev_20130112-py2.7.egg
Processing dependencies for mechanize==0.2.6.dev-20130112
Finished processing dependencies for mechanize==0.2.6.dev-20130112
@:~$ ^C
@:~$ which pip
/home//bin/pip
@:~$ which python
/home//bin/python
@:~$ which easy_install
/home//bin/easy_install
@:~$
第二次更新:
似乎是机械化的东西,如果我通过PIP添加任何其他随机包,没有问题(在这个实例html5lib)
第三更新(@DSM)
1)
>>> sys.path
['', '/home//local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/home//local/lib/python2.7/site-packages/virtualenvwrapper-2.11-py2.7.egg', '/home//src/geopy', '/home//local/lib/python2.7/site-packages/BeautifulSoup-3.2.0-py2.7.egg', '/home//local/lib/python2.7/site-packages/django_sorting-0.1-py2.7.egg' ... ]
>>>
2) *pretty long output of which most looks like:*
@:~$ ls -laR /usr/local/lib/python2.7/dist-packages/mech*
/usr/local/lib/python2.7/dist-packages/mechanize:
total 1144
...lots of other files, pretty much same permissions...
-rw-r--r-- 1 root staff 24916 Jan 11 01:19 _mechanize.py
...lots of other files...
3)
>>> import imp
>>> imp.find_module("mechanize")
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named mechanize
>>>
四个编辑(这是可笑的:/):
这类似于我之前的一个问题(Complete removal and fresh install of python on Ubuntu 12.04),如果我用sudo运行所有的东西,这很好,但我不知道我是否应该这样做…怎么了权限?