我正在尝试首次安装Python。我从Python网站下载了以下安装程序: Python 2.7.1 Windows Installer(Windows二进制文件-不包括源代码)。然后,我运行安装程序,选择“所有用户”,一切都很好。我将Python安装到默认位置:
C:\Python27
接下来,要测试Python是否已正确安装,我导航到我的Python目录,并在Windows cmd提示符下运行了“ python”命令。它返回以下错误:
ImportError:没有名为站点的模块
当我执行“ python -v”时,我得到以下信息:
#installing zipimport hook
import zipimport # builtin
#ImportError: No module named site#installed zipimport钩子#clear 内置 ._
#clear sys.path#clear sys.argv
#clear sys.ps1#clear sys.ps2
#clear sys.exitfunc#clear sys.exc_type
#clear sys.exc_value#clear sys.exc_traceback
#clear sys.last_type#clear sys.last_value
#clear sys.last_traceback#clear sys.path_hooks
#clear sys.path_importer_cache#clear sys.meta_path
#clear sys.flags#clear sys.float_info
#restore sys.stdin#恢复sys.stdout
#restore sys.stderr#cleanup 主
#cleanup[1] zipimport#cleanup[1]信号
#cleanup[1] exceptions#cleanup[1] _warnings
#cleanup sys#内置的
#cleanup ints: 6 unfreed intscleanup #cleanup浮动
当我执行dir时,C:\Python27\Lib\site.py*我得到以下信息:
C:\ Users \ Mimminito> dir C:\ Python27 \ Lib \ site.py *
驱动器C中的卷没有标签。
卷序列号是DAB9-A863C:\ Python27 \ Lib目录
13/11/2010 20:08 20,389 site.py
1文件20,389字节
0目录694,910,976字节免费
有任何想法吗?
PYTHONPATH。我将其转换为Windows风格的路径,export PYTHONPATH=$(cygpath -w $PYTHONPATH)并且效果很好。添加此注释可帮助可能遇到此问题的其他人。