问题描述
不确定是否在正确的位置发布消息,但是在使python GIS程序在Windows 7 64 bit上运行时遇到问题.这些程序可在32位XP上运行.我做了很多研究,并尝试更改我的PythonPath,移动lib文件夹等,以及其他建议.正如另一个建议的那样,我在Python26下的注册表中创建了一个新密钥,它具有Desktop10.pth文件的内容.但是,我仍然收到下面发布的相同错误.我当前正在运行ArcGIS 10.0.我可能缺少一些简单的东西!任何帮助将不胜感激!预先谢谢你.
Not sure if I am posting in the right place, but I am having problems getting my python GIS programs to work on Windows 7 64 bit. These programs worked on XP 32 bit. I've done a lot of research and tried changing my PythonPath, moving the lib folder, etc and other suggestions. I made a new key in the registry under Python26 as suggested by another with the contents of the Desktop10.pth file. However I am still getting the same error posted below. I am currently running ArcGIS 10.0. I am probably missing something simple! Any help would be greatly appreciated! Thank you in advance.
回溯(最近通话最近): 文件"Z:\ Desktop \ GISClimateMapping.py",第85行,在 导入arcpy 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy__init __.py",行 17,在 从地理处理导入gp 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy \ geoprocessing__init__.py",第14行,在 从_base导入* 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy \ geoprocessing_base.py",第568行,在 env = GPEnvironments(gp) 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy \ geoprocessing_base.py",在GPEnvironments中,第565行 返回GPEnvironment(geoprocessor) 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy \ geoprocessing_base.py",第521行,在 init 中 self._refresh() 文件"C:\ Program Files(x86)\ ArcGIS \ Desktop10.0 \ arcpy \ arcpy \ geoprocessing_base.py",第523行,在_refresh中 envset =(set(用于self._gp.listEnvironments()中env的env))RuntimeError:未初始化
Traceback (most recent call last): File "Z:\Desktop\GISClimateMapping.py", line 85, in import arcpy File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy__init__.py", line 17, in from geoprocessing import gp File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing__init__.py", line 14, in from _base import * File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing_base.py", line 568, in env = GPEnvironments(gp) File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing_base.py", line 565, in GPEnvironments return GPEnvironment(geoprocessor) File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing_base.py", line 521, in init self._refresh() File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing_base.py", line 523, in _refresh envset = (set(env for env in self._gp.listEnvironments()))RuntimeError: NotInitialized
推荐答案
即使在64位操作系统上,您也必须在Arcgis 10.0上使用32位Python 2.6.我怀疑(尽管不确定提供的信息)您安装了另一个版本的Python.我首先要检查安装了多少版本,然后卸载所有版本,但C:\ Pytho26 \ ArcGIS10.0除外.然后,在上述位置安装Python 2.6(在ArcGIS磁盘上).您还需要重新安装numpy和matplotlib,它们也在磁盘上.如果那没有帮助,那么我将卸载ArcGIS和计算机上的每个Python版本,然后重新安装ArcGIS.这听起来很激烈,但是ESRI的Python实现非常敏感,您可能会浪费大量时间来尝试查找简单的修复程序.这最后一步通常有效.
You must use Python 2.6 32 bit with Arcgis 10.0, even with a 64 bit OS. I suspect (though not sure from the info provided) that you have another version of Python installed. I would first check to see how many versions are installed, and uninstall all of them except the one at C:\Pytho26\ArcGIS10.0. Then I'd install Python 2.6 (it's on the ArcGIS disk) at the location mentioned. You'll need to re-install numpy and matplotlib too, which are also on the disk. If that does not help, then I'd uninstall ArcGIS and every Python version on your machine, and then re-install ArcGIS. This sounds drastic, but ESRI's Python implementation is pretty sensitive, and you can waste days on trying to find an easy fix. This last step usually works.
这篇关于Python ArcGIS ArcPy RuntimeError:未初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!