【发布时间】:2012-08-23 13:33:42
【问题描述】:
所以,我认为我已经正确安装了 setuptools 和 argparse 1.2.1。
C:\Python25_64bit>python ez_setup.py argparse
Searching for argparse
Best match: argparse 1.2.1
Processing argparse-1.2.1-py2.5.egg
argparse 1.2.1 is already the active version in easy-install.pth
Using c:\python25_64bit\lib\site-packages\argparse-1.2.1-py2.5.egg
Processing dependencies for argparse
Finished processing dependencies for argparse
C:\Python25_64bit>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:19:34) [MSC v.1400 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named argparse
>>> quit()
但是,如您在上面看到的,我似乎无法导入它。我还尝试将 egg 直接添加到我的 Eclipse PyDev 项目中,但这也无济于事。如您所见,我的环境中没有设置任何内容。或许,这就是问题所在?
C:\Python25_64bit>echo %PYTHONPATH%
%PYTHONPATH%
C:\Python25_64bit>echo %PYTHONHOME%
%PYTHONHOME%
【问题讨论】:
-
我一直认为 Lib/site-packages 是导入搜索路径的一部分。这是不正确的吗?
C:\Python25_64bit\Lib\site-packages>dir ... Directory of C:\Python25_64bit\Lib\site-packages 08/28/2012 05:41 PM <DIR> . 08/28/2012 05:41 PM <DIR> .. 08/27/2012 10:55 AM 21,499 argparse-1.2.1-py2.5.egg
标签: windows arguments command-line-arguments argparse python-2.5