问题描述
我是第一次尝试安装 Python.我从 Python 网站下载了以下安装程序:Python 2.7.1 Windows Installer(Windows 二进制文件 -- 不包括来源).然后我运行安装程序,选择所有用户",一切都很好.我将 Python 安装到默认位置:
I am trying to install Python for the first time. I downloaded the following installer from the Python website:Python 2.7.1 Windows Installer (Windows binary -- does not include source). I then ran the installer, selected 'All Users' and all was fine. I installed Python into the default location:
C:Python27
接下来,为了测试 Python 是否安装正确,我导航到我的 Python 目录,并在 Windows cmd 提示符下运行python"命令.它返回以下错误:
Next, to test that Python was installed correctly, I navigated to my Python Directory, and ran the "python" command in the windows cmd prompt. It returns me the following error:
导入错误:没有名为站点的模块
当我执行 'python -v' 时,我得到以下信息:
When I do 'python -v' I get the following:
#installing zipimport 钩子
#installed zipimport 钩子
导入 zipimport # 内置#ImportError: 没有名为站点的模块
#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
#restore sys.stdout#restore sys.stderr
#cleanup 主要#cleanup
[1] zipimport
#cleanup[1
] 信号#cleanup
[1] 异常
#cleanup[1
] _warnings#cleanup 系统
#cleanup 内置#cleanup ints:6 个未释放的整数
#cleanup 浮动
当我执行 dir C:Python27Libsite.py*
我得到以下内容:
When I do dir C:Python27Libsite.py*
I get the following:
C:UsersMimminito>dir C:Python27Libsite.py*
驱动器 C 中的卷没有标签.
卷序列号为 DAB9-A863
C:Python27Lib 目录
Directory of C:Python27Lib
13/11/2010 20:08 20,389 site.py
1 个文件 20,389 字节
0 目录 694,910,976 字节空闲
13/11/2010 20:08 20,389 site.py
1 File(s) 20,389 bytes
0 Dir(s) 694,910,976 bytes free
有什么想法吗?
推荐答案
这个问题我自己找了快一天,终于有了突破.试试这个:
I've been looking into this problem for myself for almost a day and finally had a breakthrough. Try this:
设置 PYTHONPATH/PYTHONHOME 变量
右键单击开始菜单中的计算机图标,转到属性.在左侧选项卡上,转到高级系统设置.在出现的窗口中,转到高级选项卡,然后在底部单击环境变量.单击用户变量列表并开始键入 Python,然后对 系统变量 重复此操作,以确保您没有为 PYTHONPATH 或 PYTHONHOME 设置错误的变量.接下来,添加新变量(我在 System 而不是 User,虽然它也适用于 User):PYTHONPATH,设置为 C:Python27Lib.PYTHONHOME
,设置为C:Python27.
Right click the Computer icon in the start menu, go to properties.On the left tab, go to Advanced system settings. In the window that comes up, go to the Advanced tab, then at the bottom click Environment Variables. Click in the list of user variables and start typing Python, and repeat for System variables, just to make certain that you don't have mis-set variables for PYTHONPATH or PYTHONHOME. Next, add new variables (I did in System rather than User, although it may work for User too): PYTHONPATH, set to C:Python27Lib. PYTHONHOME
, set to C:Python27.
希望这有帮助!
这篇关于导入错误:Windows 上没有名为站点的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!