我试着用简单的安装来安装模块。它似乎已经安装,但我无法导入它。import python module
# easy_install uuid
Searching for uuid
Reading http://pypi.python.org/simple/uuid/
Reading http://zesty.ca/python/
Best match: uuid 1.30
Downloading http://pypi.python.org/packages/source/u/uuid/uuid-1.30.tar.gz#md5=639b310f1fe6800e4bf8aa1dd9333117
Processing uuid-1.30.tar.gz
Running uuid-1.30/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mQlxdg/uuid-1.30/egg-dist-tmp-gLpk9N
zip_safe flag not set; analyzing archive contents...
Adding uuid 1.30 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/uuid-1.30-py2.6.egg
Processing dependencies for uuid
Finished processing dependencies for uuid
# python
>>> import uuid
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named uuid
# python -V
Python 2.4.3
[documentation](http://packages.python.org/distribute/easy_install.html#multiple-python-versions)还表示您可以在命令行中指定'easy_install'目标的版本。 (例如'easy_install-2.4') –
是的。但是,偶尔我会遇到安装了相同版本Python的多个副本的情况(在OS X上,如果您在系统Python中安装'python.org'Python),就会发生这种情况。在这种情况下,最好使用解释器调用本身来消除歧义。 – nneonneo
这不太可能有帮助,因为如果你有两个'python-2.6's,那么无论如何,你都会首先得到'PATH'上的那个,就像你运行'easy_install-2.6'一样。 – Julian