Windows 7 64位上的PyDev 2.7.1:获取解释器信息时出错(与QGIS相关)

0 投票
1 回答
1069 浏览
提问于 2025-04-17 17:42

我在电脑上安装了QGIS,这是通过OSGeo4W这个软件包安装的,里面还包含了Python 2.7和很多用于空间处理的Python库。

在我的Windows 7系统中,我设置了以下环境变量:

Path = [...];C:\OSGeo4W\bin

PYTHONPATH = C:\OSGeo4W\apps\python27\lib;
C:\OSGeo4W\apps\qgis\python;
C:\Users\username\.qgis\python;
C:\Users\username\.qgis\python\plugins;
C:\OSGeo4W\apps\qgis\python\plugins;
C:\OSGeo4W\apps\python27\DLLs;
C:\OSGeo4W\apps\qgis\bin;
C:\OSGeo4W\apps\python27\lib\site-packages;
C:\OSGeo4W\apps\qgis\python\plugins\fTools;

当我在Windows 7的命令行中执行C:\OSGeo4W\bin\python.exe或者直接输入python(因为它能正确识别)时,我可以顺利导入一些库,比如import pyspatialite,所以我觉得PYTHONPATH这个变量设置得没问题。

不过,当我尝试在PyDev中添加Python解释器时,却遇到了以下错误:

Error getting info on interpreter: See error log for details.
No output was in the standard output when trying to create the interpreter info.
The error output contains:>>ImportError: No module named site<<

就好像PyDev没有识别PYTHONPATH一样。而且在“库”选项卡下,我也看不到任何条目(这又说明PyDev没有识别PYTHONPATH)。

我已经重启了Eclipse,但还是没用。

更新:重启整个系统后问题解决了。天哪,我们还活在90年代。

1 个回答

0

重启整个Windows 7系统有帮助。感觉还是像回到了Windows XP时代一样..

撰写回答