{"id":1113796,"date":"2025-01-08T17:51:22","date_gmt":"2025-01-08T09:51:22","guid":{"rendered":""},"modified":"2025-01-08T17:51:24","modified_gmt":"2025-01-08T09:51:24","slug":"arcpy%e5%a6%82%e4%bd%95%e5%af%bc%e5%85%a5%e5%88%b0python3%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1113796.html","title":{"rendered":"arcpy\u5982\u4f55\u5bfc\u5165\u5230python3\u4e2d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25075249\/71569079-6581-407a-85b0-23a00343955e.webp\" alt=\"arcpy\u5982\u4f55\u5bfc\u5165\u5230python3\u4e2d\" \/><\/p>\n<p><p> <strong>arcpy<\/strong> \u662f ArcGIS \u7684 Python \u6a21\u5757\uff0c\u7528\u4e8e\u5730\u7406\u4fe1\u606f\u7cfb\u7edf (GIS) \u7684\u81ea\u52a8\u5316\u5904\u7406\u548c\u7a7a\u95f4\u5206\u6790\u3002\u5bfc\u5165 <strong>arcpy<\/strong> \u5230 Python 3 \u4e2d\uff0c\u9700\u8981\u786e\u4fdd\u5b89\u88c5\u4e86 ArcGIS Desktop \u6216 ArcGIS Pro\uff0c\u5e76\u4e14\u5df2\u8bbe\u7f6e\u6b63\u786e\u7684 Python \u73af\u5883\u3002\u4ee5\u4e0b\u662f\u5bfc\u5165 <strong>arcpy<\/strong> \u5230 Python 3 \u4e2d\u7684\u51e0\u79cd\u65b9\u6cd5\uff1a<strong>\u5b89\u88c5 ArcGIS Pro\u3001\u914d\u7f6e Python \u73af\u5883\u3001\u4f7f\u7528 Conda \u7ba1\u7406\u73af\u5883\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u6d4b\u8bd5 arcpy \u5bfc\u5165<\/strong>\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u6267\u884c\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5 ArcGIS Pro<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\uff0c\u60a8\u9700\u8981\u5b89\u88c5 ArcGIS Pro\u3002ArcGIS Pro \u662f Esri \u63d0\u4f9b\u7684\u6700\u65b0\u684c\u9762 GIS \u8f6f\u4ef6\uff0c\u5305\u542b <strong>arcpy<\/strong> \u6a21\u5757\u3002\u8bf7\u786e\u4fdd\u60a8\u62e5\u6709\u6709\u6548\u7684 ArcGIS Pro \u8bb8\u53ef\u8bc1\uff0c\u5e76\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u8bbf\u95ee Esri \u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7d ArcGIS Pro \u5b89\u88c5\u7a0b\u5e8f\u3002<\/li>\n<li>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u542f\u52a8 ArcGIS Pro \u5e76\u767b\u5f55\u60a8\u7684 Esri \u8d26\u6237\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u914d\u7f6e Python \u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5 ArcGIS Pro \u540e\uff0c\u60a8\u9700\u8981\u914d\u7f6e Python \u73af\u5883\u4ee5\u4fbf\u80fd\u591f\u5bfc\u5165 <strong>arcpy<\/strong> \u6a21\u5757\u3002ArcGIS Pro \u9ed8\u8ba4\u4f7f\u7528 Anaconda \u53d1\u884c\u7248\u7684 Python 3 \u73af\u5883\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u914d\u7f6e Python \u73af\u5883\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00 ArcGIS Pro\u3002<\/li>\n<li>\u9009\u62e9\u201c\u9879\u76ee\u201d\u9009\u9879\u5361\uff0c\u7136\u540e\u9009\u62e9\u201cPython\u201d\u3002<\/li>\n<li>\u5728\u201cPython\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u201c\u7ba1\u7406\u73af\u5883\u201d\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Python \u73af\u5883\u6216\u9009\u62e9\u73b0\u6709\u73af\u5883\u3002<\/li>\n<li>\u786e\u4fdd\u9009\u4e2d\u7684\u73af\u5883\u5305\u542b <strong>arcpy<\/strong> \u6a21\u5757\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u4f7f\u7528 Conda \u7ba1\u7406\u73af\u5883<\/h3>\n<\/p>\n<p><p>ArcGIS Pro \u4f7f\u7528 Conda \u4f5c\u4e3a\u5305\u7ba1\u7406\u5668\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Conda \u521b\u5efa\u548c\u7ba1\u7406 Python \u73af\u5883\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 Conda \u7ba1\u7406\u73af\u5883\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216 Anaconda Prompt\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Conda \u73af\u5883\uff0c\u5e76\u6307\u5b9a Python \u7248\u672c\uff1a\n<pre><code class=\"language-bash\">conda create -n arcpy_env python=3.7<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u6fc0\u6d3b\u65b0\u521b\u5efa\u7684\u73af\u5883\uff1a\n<pre><code class=\"language-bash\">conda activate arcpy_env<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5b89\u88c5 <strong>arcpy<\/strong> \u6a21\u5757\uff1a\n<pre><code class=\"language-bash\">conda install -c esri arcpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u786e\u4fdd\u73af\u5883\u5df2\u6b63\u786e\u914d\u7f6e\uff1a\n<pre><code class=\"language-bash\">python -c &quot;import arcpy; print(arcpy.GetInstallInfo())&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u5bfc\u5165 <strong>arcpy<\/strong> \u6a21\u5757\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u8def\u5f84\u95ee\u9898\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u6765\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7cfb\u7edf\u5c5e\u6027\uff0c\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u9009\u62e9\u201c\u65b0\u5efa\u201d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u73af\u5883\u53d8\u91cf\uff1a\n<ul>\n<li>\u53d8\u91cf\u540d\uff1a <code>PYTHONPATH<\/code><\/li>\n<li>\u53d8\u91cf\u503c\uff1a <code>C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\u9009\u62e9\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u6d4b\u8bd5 arcpy \u5bfc\u5165<\/h3>\n<\/p>\n<p><p>\u914d\u7f6e\u5b8c Python \u73af\u5883\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6d4b\u8bd5 <strong>arcpy<\/strong> \u6a21\u5757\u662f\u5426\u6210\u529f\u5bfc\u5165\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216 Anaconda Prompt\u3002<\/li>\n<li>\u6fc0\u6d3b\u914d\u7f6e\u7684 Conda \u73af\u5883\uff08\u5982\u679c\u5c1a\u672a\u6fc0\u6d3b\uff09\uff1a\n<pre><code class=\"language-bash\">conda activate arcpy_env<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u542f\u52a8 Python \u89e3\u91ca\u5668\uff1a\n<pre><code class=\"language-bash\">python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728 Python \u89e3\u91ca\u5668\u4e2d\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a\n<pre><code class=\"language-python\">import arcpy<\/p>\n<p>print(arcpy.GetInstallInfo())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5982\u679c <strong>arcpy<\/strong> \u6a21\u5757\u6210\u529f\u5bfc\u5165\uff0c\u60a8\u5c06\u770b\u5230\u4e0e ArcGIS Pro \u5b89\u88c5\u76f8\u5173\u7684\u4fe1\u606f\u3002<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><p>\u5728\u5bfc\u5165 <strong>arcpy<\/strong> \u6a21\u5757\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u8def\u5f84\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5bfc\u5165 <strong>arcpy<\/strong> \u65f6\u9047\u5230\u8def\u5f84\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u6b63\u786e\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf <code>PYTHONPATH<\/code>\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u60a8\u4f7f\u7528\u7684\u662f ArcGIS Pro \u63d0\u4f9b\u7684 Python \u73af\u5883\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u6743\u9650\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5bfc\u5165 <strong>arcpy<\/strong> \u65f6\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u60a8\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u547d\u4ee4\u63d0\u793a\u7b26\u6216 Anaconda Prompt\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u60a8\u7684\u7528\u6237\u8d26\u6237\u5177\u6709\u8bbf\u95ee ArcGIS Pro \u5b89\u88c5\u76ee\u5f55\u7684\u6743\u9650\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u6a21\u5757\u672a\u627e\u5230<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5bfc\u5165 <strong>arcpy<\/strong> \u65f6\u9047\u5230\u6a21\u5757\u672a\u627e\u5230\u7684\u9519\u8bef\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u6b63\u786e\u5b89\u88c5 ArcGIS Pro \u5e76\u914d\u7f6e\u4e86 Python \u73af\u5883\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 Conda \u68c0\u67e5 <strong>arcpy<\/strong> \u6a21\u5757\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda list arcpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c <strong>arcpy<\/strong> \u6a21\u5757\u672a\u5217\u51fa\uff0c\u8bf7\u6309\u7167\u524d\u6587\u6b65\u9aa4\u91cd\u65b0\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001arcpy \u6a21\u5757\u7684\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u6210\u529f\u5bfc\u5165 <strong>arcpy<\/strong> \u6a21\u5757\u540e\uff0c\u60a8\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528\u5b83\u8fdb\u884c GIS \u6570\u636e\u5904\u7406\u548c\u5206\u6790\u3002\u4ee5\u4e0b\u662f <strong>arcpy<\/strong> \u6a21\u5757\u7684\u4e00\u4e9b\u57fa\u672c\u7528\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u521b\u5efa\u8981\u7d20\u7c7b<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u65b0\u7684\u8981\u7d20\u7c7b\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u70b9\u8981\u7d20\u7c7b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4<\/strong><\/h2>\n<p>arcpy.env.workspace = &quot;C:\/data&quot;<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u70b9\u8981\u7d20\u7c7b<\/strong><\/h2>\n<p>arcpy.management.CreateFeatureclass(&quot;C:\/data&quot;, &quot;points.shp&quot;, &quot;POINT&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u6dfb\u52a0\u5b57\u6bb5<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u5411\u8981\u7d20\u7c7b\u6dfb\u52a0\u5b57\u6bb5\u3002\u4f8b\u5982\uff0c\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3a &quot;name&quot; \u7684\u6587\u672c\u5b57\u6bb5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u6dfb\u52a0\u5b57\u6bb5<\/strong><\/h2>\n<p>arcpy.management.AddField(&quot;C:\/data\/points.shp&quot;, &quot;name&quot;, &quot;TEXT&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u63d2\u5165\u8981\u7d20<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u5411\u8981\u7d20\u7c7b\u63d2\u5165\u8981\u7d20\u3002\u4f8b\u5982\uff0c\u63d2\u5165\u4e00\u4e2a\u70b9\u8981\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u521b\u5efa\u63d2\u5165\u6e38\u6807<\/strong><\/h2>\n<p>cursor = arcpy.da.InsertCursor(&quot;C:\/data\/points.shp&quot;, [&quot;SHAPE@XY&quot;, &quot;name&quot;])<\/p>\n<h2><strong>\u63d2\u5165\u70b9\u8981\u7d20<\/strong><\/h2>\n<p>cursor.insertRow([(100, 100), &quot;Point 1&quot;])<\/p>\n<h2><strong>\u91ca\u653e\u6e38\u6807<\/strong><\/h2>\n<p>del cursor<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u9009\u62e9\u8981\u7d20<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u9009\u62e9\u8981\u7d20\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u6240\u6709\u70b9\u8981\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u521b\u5efa\u641c\u7d22\u6e38\u6807<\/strong><\/h2>\n<p>cursor = arcpy.da.SearchCursor(&quot;C:\/data\/points.shp&quot;, [&quot;SHAPE@XY&quot;, &quot;name&quot;])<\/p>\n<h2><strong>\u904d\u5386\u8981\u7d20<\/strong><\/h2>\n<p>for row in cursor:<\/p>\n<p>    print(row)<\/p>\n<h2><strong>\u91ca\u653e\u6e38\u6807<\/strong><\/h2>\n<p>del cursor<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u8fdb\u9636\u4f7f\u7528\u6280\u5de7<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u57fa\u672c\u7528\u6cd5\uff0c<strong>arcpy<\/strong> \u6a21\u5757\u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u529f\u80fd\u548c\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u66f4\u590d\u6742\u7684 GIS \u6570\u636e\u5904\u7406\u548c\u5206\u6790\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u8fdb\u9636\u4f7f\u7528\u6280\u5de7\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u6279\u91cf\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u8fdb\u884c\u6279\u91cf\u5904\u7406\u3002\u4f8b\u5982\uff0c\u6279\u91cf\u521b\u5efa\u8981\u7d20\u7c7b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4<\/strong><\/h2>\n<p>arcpy.env.workspace = &quot;C:\/data&quot;<\/p>\n<h2><strong>\u521b\u5efa\u591a\u4e2a\u8981\u7d20\u7c7b<\/strong><\/h2>\n<p>for i in range(1, 6):<\/p>\n<p>    arcpy.management.CreateFeatureclass(&quot;C:\/data&quot;, f&quot;points_{i}.shp&quot;, &quot;POINT&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5730\u7406\u5904\u7406\u5de5\u5177<\/h4>\n<\/p>\n<p><p><strong>arcpy<\/strong> \u6a21\u5757\u63d0\u4f9b\u4e86\u8bb8\u591a\u5730\u7406\u5904\u7406\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u8fdb\u884c\u7a7a\u95f4\u5206\u6790\u3002\u4f8b\u5982\uff0c\u7f13\u51b2\u5206\u6790\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u7f13\u51b2\u5206\u6790<\/strong><\/h2>\n<p>arcpy.analysis.Buffer(&quot;C:\/data\/points.shp&quot;, &quot;C:\/data\/points_buffer.shp&quot;, &quot;100 Meters&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u7a7a\u95f4\u67e5\u8be2<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u8fdb\u884c\u7a7a\u95f4\u67e5\u8be2\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u5728\u6307\u5b9a\u8303\u56f4\u5185\u7684\u8981\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<h2><strong>\u521b\u5efa\u7a7a\u95f4\u67e5\u8be2<\/strong><\/h2>\n<p>query = arcpy.management.SelectLayerByLocation(&quot;C:\/data\/points.shp&quot;, &quot;WITHIN_A_DISTANCE&quot;, &quot;C:\/data\/points_buffer.shp&quot;, &quot;100 Meters&quot;)<\/p>\n<h2><strong>\u904d\u5386\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>cursor = arcpy.da.SearchCursor(query, [&quot;SHAPE@XY&quot;, &quot;name&quot;])<\/p>\n<p>for row in cursor:<\/p>\n<p>    print(row)<\/p>\n<h2><strong>\u91ca\u653e\u6e38\u6807<\/strong><\/h2>\n<p>del cursor<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5bfc\u5165 <strong>arcpy<\/strong> \u6a21\u5757\u5230 Python 3 \u4e2d\uff0c\u4e3b\u8981\u6d89\u53ca\u5b89\u88c5 ArcGIS Pro\u3001\u914d\u7f6e Python \u73af\u5883\u3001\u4f7f\u7528 Conda \u7ba1\u7406\u73af\u5883\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u4ee5\u53ca\u6d4b\u8bd5 <strong>arcpy<\/strong> \u5bfc\u5165\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u5e76\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u3002\u6b64\u5916\uff0c\u8fd8\u4ecb\u7ecd\u4e86 <strong>arcpy<\/strong> \u6a21\u5757\u7684\u57fa\u672c\u7528\u6cd5\u548c\u8fdb\u9636\u4f7f\u7528\u6280\u5de7\u3002\u901a\u8fc7\u672c\u6587\uff0c\u60a8\u53ef\u4ee5\u638c\u63e1\u5982\u4f55\u5728 Python 3 \u4e2d\u4f7f\u7528 <strong>arcpy<\/strong> \u6a21\u5757\u8fdb\u884c GIS \u6570\u636e\u5904\u7406\u548c\u5206\u6790\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u80fd\u591f\u6709\u6548\u5730\u63d0\u9ad8\u60a8\u7684 GIS \u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python 3\u4e2d\u4f7f\u7528arcpy\uff1f<\/strong><br \/>\u8981\u5728Python 3\u4e2d\u4f7f\u7528arcpy\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u60a8\u7684\u73af\u5883\u4e2d\u5b89\u88c5\u4e86ArcGIS Pro\uff0c\u56e0\u4e3aarcpy\u662fArcGIS\u7684Python\u5e93\u3002\u5b89\u88c5ArcGIS Pro\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u6216\u811a\u672c\u4e2d\u8f93\u5165\u201cimport arcpy\u201d\u6765\u5bfc\u5165\u8be5\u5e93\u3002\u786e\u4fdd\u4f7f\u7528\u4e0eArcGIS Pro\u7248\u672c\u517c\u5bb9\u7684Python\u73af\u5883\u3002<\/p>\n<p><strong>arcpy\u4e0e\u5176\u4ed6GIS\u5e93\u76f8\u6bd4\u6709\u4ec0\u4e48\u4f18\u52bf\uff1f<\/strong><br \/>arcpy\u5728\u529f\u80fd\u4e0a\u975e\u5e38\u5f3a\u5927\uff0c\u7279\u522b\u662f\u5728\u5730\u7406\u5904\u7406\u3001\u7a7a\u95f4\u5206\u6790\u548c\u6570\u636e\u7ba1\u7406\u65b9\u9762\u3002\u4e0e\u5176\u4ed6GIS\u5e93\u76f8\u6bd4\uff0c\u5982GDAL\u6216GeoPandas\uff0carcpy\u63d0\u4f9b\u4e86\u66f4\u52a0\u96c6\u6210\u7684\u5de5\u5177\u96c6\uff0c\u5c24\u5176\u662f\u5728ArcGIS\u73af\u5883\u4e2d\u3002\u5b83\u80fd\u591f\u76f4\u63a5\u8bbf\u95eeArcGIS\u7684\u6240\u6709\u529f\u80fd\uff0c\u9002\u5408\u9700\u8981\u590d\u6742\u5730\u7406\u5904\u7406\u7684\u7528\u6237\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u4f7f\u7528arcpy\u8fdb\u884c\u54ea\u4e9b\u7c7b\u578b\u7684\u5730\u7406\u5904\u7406\uff1f<\/strong><br \/>arcpy\u63d0\u4f9b\u4e86\u5e7f\u6cdb\u7684\u529f\u80fd\uff0c\u5305\u62ec\u6570\u636e\u5bfc\u5165\u5bfc\u51fa\u3001\u7a7a\u95f4\u5206\u6790\u3001\u5730\u56fe\u5236\u4f5c\u3001\u5730\u7406\u6570\u636e\u7ba1\u7406\u3001\u6a21\u578b\u6784\u5efa\u7b49\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528arcpy\u8fdb\u884c\u7f13\u51b2\u533a\u5206\u6790\u3001\u53e0\u52a0\u5206\u6790\u3001\u6570\u636e\u8f6c\u6362\u7b49\u64cd\u4f5c\uff0c\u8fd9\u4f7f\u5f97\u5b83\u6210\u4e3aGIS\u4e13\u4e1a\u4eba\u58eb\u548c\u7814\u7a76\u4eba\u5458\u7684\u7406\u60f3\u9009\u62e9\u3002\u4f7f\u7528arcpy\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199\u81ea\u52a8\u5316\u811a\u672c\u6765\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"arcpy \u662f ArcGIS \u7684 Python \u6a21\u5757\uff0c\u7528\u4e8e\u5730\u7406\u4fe1\u606f\u7cfb\u7edf (GIS) \u7684\u81ea\u52a8\u5316\u5904\u7406\u548c\u7a7a\u95f4\u5206\u6790\u3002\u5bfc [&hellip;]","protected":false},"author":3,"featured_media":1113805,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1113796"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1113796"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1113796\/revisions"}],"predecessor-version":[{"id":1113807,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1113796\/revisions\/1113807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1113805"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1113796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1113796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1113796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}