Problem: Unable to import arcpy
【相关信息】
Article ID: 43846
Bug Id: N/A
Software:
ArcGIS for Desktop Advanced 10.1, 10.2, 10.2.1, 10.2.2
ArcGIS for Desktop Standard 10.1, 10.2, 10.2.1, 10.2.2
ArcGIS for Desktop Basic 10.1, 10.2, 10.2.1, 10.2.2
Platforms: N/A
【问题描述】
Users are unable to import or load arcpy in ArcMap with the installed version of Python.
【原因】
There are several possible causes:
Incorrect version or bit version (64-bit) of Python required by ArcMap. To check the system requirements, please refer to the links provided.
Incorrect path to the default Python installation.
Incorrect PythonWin installation folder.
Users can install different versions or bit versions of Python. ArcMap requires Python 2.7.x (32-bit). For more information, refer to the following article,
FAQ: What version of Python is used in ArcGIS?
Using a version of Python other than the version expected with ArcGIS can lead to compatibility issues.
Article ID: 43846
Bug Id: N/A
Software:
ArcGIS for Desktop Advanced 10.1, 10.2, 10.2.1, 10.2.2
ArcGIS for Desktop Standard 10.1, 10.2, 10.2.1, 10.2.2
ArcGIS for Desktop Basic 10.1, 10.2, 10.2.1, 10.2.2
Platforms: N/A
【问题描述】
Users are unable to import or load arcpy in ArcMap with the installed version of Python.
【原因】
There are several possible causes:
Incorrect version or bit version (64-bit) of Python required by ArcMap. To check the system requirements, please refer to the links provided.
Incorrect path to the default Python installation.
Incorrect PythonWin installation folder.
Users can install different versions or bit versions of Python. ArcMap requires Python 2.7.x (32-bit). For more information, refer to the following article,
FAQ: What version of Python is used in ArcGIS?
Using a version of Python other than the version expected with ArcGIS can lead to compatibility issues.
1 个回复
EsriSupport
赞同来自:
Use one of the following solutions to resolve this issue.
Change the association of Python to use 32-bit Python. For more information, refer to the following article, FAQ: Why do Python scripts fail on a machine with both ArcGIS for Server and Desktop Installed?
Change the path to the Python.exe file in Windows' Environment Variables. Follow the steps below. 1. Access the Environment Variables. The location of the Environment Variables differs based on the operating system.
▪ Windows XP:
How To Manage Environment Variables in Windows XP - Microsoft Support.
▪ Windows 7 and 8:
a. Click the Start button, and right-click Computer.
b. Select Properties.
c. Click 'Advanced system settings'.
d. Click 'Environment Variables'.
2. Under the 'System variables' column, find the Path variable and click the Edit button.
3. In the 'Variable value' section, locate and remove any existing path to the Python.exe file. Remove only the text between the semicolons (;).
4. At the end of the 'Variable value' section, add a new semicolon and write the path to the Python.exe file installed by ArcGIS for Desktop: 'C:\Python27\ArcGIS10.x'.
5. Click OK.
Add the path needed by modifying the .pth file. 1. Navigate to C:\Python27\ArcGIS10.x\Lib\site-packages.
2. Using a text editor, such as Notepad, open the Desktop10.x.pth file.
3. Verify the following lines are present in the text file:
C:\Program Files (x86)\ArcGIS\Desktop10.x\bin
C:\Program Files (x86)\ArcGIS\Desktop10.x\ArcPy
C:\Program Files (x86)\ArcGIS\Desktop10.x\ArcToolbox\Scripts
4. Add any of the missing paths to the file.
5. Save the .pth file.
Repair the ArcGIS for Desktop installation. Follow the steps listed below. 1. Remove any pre-installed Python software.
2. There are two options for repairing ArcMap:
▪ Rerun the installation tool, and click the Repair radio button.
▪ Navigate to the Control Panel > Programs > Programs and Features > Uninstall a program, and select ArcMap. Click the Repair radio button.
If using PythonWin with pre-installed Python: Without ArcMap, the default installation path for PythonWin is: C:\Python27\Lib\site-packages\pythonwin\Pythonwin.exe
Instead, PythonWin must be installed in the following path:
C:\Python27\ArcGIS10.x\Lib\site-packages\pythonwin\Pythonwin.exe
To ensure the correct default path is used during installation, uninstall PythonWin, follow the previous step provided to repair ArcMap, and reinstall PythonWin.
Users are unable to select the default installation path for PythonWin during installation. The steps to repair ArcMap are crucial to ensure the correct destination path.
【其它相关参考】
【创建及修改时间】
Created: 1/5/2015
Last Modified: 2/4/2015
【原文链接】
http://support.esri.com/en/kno ... 43846
要回复问题请先登录或注册