• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 搭建Windows开发环境<a name="ZH-CN_TOPIC_0000001124187462"></a>
2
3-   [获取软件](#zh-cn_topic_0000001058091994_section1483143015558)
4-   [安装Visual Studio Code](#zh-cn_topic_0000001058091994_section71401018163318)
5-   [安装Python](#zh-cn_topic_0000001058091994_section16266553175320)
6-   [安装Node.js](#zh-cn_topic_0000001058091994_section5353233124511)
7-   [安装hpm](#zh-cn_topic_0000001058091994_section173054793610)
8-   [安装DevEco Device Tool插件](#zh-cn_topic_0000001058091994_section4336315185716)
9
10系统要求:
11
12-   Windows 10 64位系统。
13-   系统的用户名不能含有中文字符。
14
15DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展,安装分为如下几步:
16
171.  安装Visual Studio Code
182.  安装Python
193.  安装Node.js
204.  安装hpm
215.  安装DevEco Device Tool插件
22
23## 获取软件<a name="zh-cn_topic_0000001058091994_section1483143015558"></a>
24
25<a name="zh-cn_topic_0000001058091994_table12730195765616"></a>
26<table><thead align="left"><tr id="zh-cn_topic_0000001058091994_row6730125785610"><th class="cellrowborder" valign="top" width="19.49%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001058091994_p1573065716561"><a name="zh-cn_topic_0000001058091994_p1573065716561"></a><a name="zh-cn_topic_0000001058091994_p1573065716561"></a>工具名称</p>
27</th>
28<th class="cellrowborder" valign="top" width="20.5%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001058091994_p197306572566"><a name="zh-cn_topic_0000001058091994_p197306572566"></a><a name="zh-cn_topic_0000001058091994_p197306572566"></a>用途说明</p>
29</th>
30<th class="cellrowborder" valign="top" width="20.03%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001058091994_p373085711569"><a name="zh-cn_topic_0000001058091994_p373085711569"></a><a name="zh-cn_topic_0000001058091994_p373085711569"></a>版本要求</p>
31</th>
32<th class="cellrowborder" valign="top" width="39.98%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001058091994_p197309576566"><a name="zh-cn_topic_0000001058091994_p197309576566"></a><a name="zh-cn_topic_0000001058091994_p197309576566"></a>获取渠道</p>
33</th>
34</tr>
35</thead>
36<tbody><tr id="zh-cn_topic_0000001058091994_row12730155765618"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p123931728135713"><a name="zh-cn_topic_0000001058091994_p123931728135713"></a><a name="zh-cn_topic_0000001058091994_p123931728135713"></a>Visual Studio Code</p>
37</td>
38<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p12332194816317"><a name="zh-cn_topic_0000001058091994_p12332194816317"></a><a name="zh-cn_topic_0000001058091994_p12332194816317"></a>代码编辑工具</p>
39</td>
40<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p711918919618"><a name="zh-cn_topic_0000001058091994_p711918919618"></a><a name="zh-cn_topic_0000001058091994_p711918919618"></a>V1.53及以上64位版本。</p>
41</td>
42<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p2721438193710"><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a href="https://code.visualstudio.com/Download" target="_blank" rel="noopener noreferrer">https://code.visualstudio.com/Download</a></p>
43</td>
44</tr>
45<tr id="zh-cn_topic_0000001058091994_row187311257185619"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p21270444579"><a name="zh-cn_topic_0000001058091994_p21270444579"></a><a name="zh-cn_topic_0000001058091994_p21270444579"></a>Python</p>
46</td>
47<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p547205817316"><a name="zh-cn_topic_0000001058091994_p547205817316"></a><a name="zh-cn_topic_0000001058091994_p547205817316"></a>编译构建工具</p>
48</td>
49<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p1991315166416"><a name="zh-cn_topic_0000001058091994_p1991315166416"></a><a name="zh-cn_topic_0000001058091994_p1991315166416"></a>V3.8.9及以上64位版本</p>
50</td>
51<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p108321457411"><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p>
52</td>
53</tr>
54<tr id="zh-cn_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p16405151165717"><a name="zh-cn_topic_0000001058091994_p16405151165717"></a><a name="zh-cn_topic_0000001058091994_p16405151165717"></a>Node.js</p>
55</td>
56<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1773185765616"><a name="zh-cn_topic_0000001058091994_p1773185765616"></a><a name="zh-cn_topic_0000001058091994_p1773185765616"></a>提供npm环境</p>
57</td>
58<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p16304104120181"><a name="zh-cn_topic_0000001058091994_p16304104120181"></a><a name="zh-cn_topic_0000001058091994_p16304104120181"></a>以下版本三选一:</p>
59<a name="zh-cn_topic_0000001058091994_ul875854471719"></a><a name="zh-cn_topic_0000001058091994_ul875854471719"></a><ul id="zh-cn_topic_0000001058091994_ul875854471719"><li>V12.22.5及以上64位版本</li><li>V14.17.5及以上64版本</li><li>V16.6.0及以上64位版本</li></ul>
60</td>
61<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p9200911141112"><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/zh-cn/download/</a></p>
62</td>
63</tr>
64<tr id="zh-cn_topic_0000001058091994_row6731105715561"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p2081865318571"><a name="zh-cn_topic_0000001058091994_p2081865318571"></a><a name="zh-cn_topic_0000001058091994_p2081865318571"></a>hpm</p>
65</td>
66<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1632215161040"><a name="zh-cn_topic_0000001058091994_p1632215161040"></a><a name="zh-cn_topic_0000001058091994_p1632215161040"></a>包管理工具</p>
67</td>
68<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p773185715566"><a name="zh-cn_topic_0000001058091994_p773185715566"></a><a name="zh-cn_topic_0000001058091994_p773185715566"></a>V1.3.0及以上</p>
69</td>
70<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p14731125745610"><a name="zh-cn_topic_0000001058091994_p14731125745610"></a><a name="zh-cn_topic_0000001058091994_p14731125745610"></a>请参考<a href="#zh-cn_topic_0000001058091994_section173054793610">安装hpm</a>。</p>
71</td>
72</tr>
73<tr id="zh-cn_topic_0000001058091994_row13317205645717"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p143411112587"><a name="zh-cn_topic_0000001058091994_p143411112587"></a><a name="zh-cn_topic_0000001058091994_p143411112587"></a>DevEco Device Tool</p>
74</td>
75<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1690316506517"><a name="zh-cn_topic_0000001058091994_p1690316506517"></a><a name="zh-cn_topic_0000001058091994_p1690316506517"></a>OpenHarmony源码的编译、烧录、调试插件工具</p>
76</td>
77<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p113171956185715"><a name="zh-cn_topic_0000001058091994_p113171956185715"></a><a name="zh-cn_topic_0000001058091994_p113171956185715"></a>V2.2 Beta2</p>
78</td>
79<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p3503163074720"><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download_beta" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download_beta</a></p>
80<p id="zh-cn_topic_0000001058091994_p23171856135717"><a name="zh-cn_topic_0000001058091994_p23171856135717"></a><a name="zh-cn_topic_0000001058091994_p23171856135717"></a>下载前,请使用华为开发者帐号登录,如未注册,请先<a href="https://developer.huawei.com/consumer/cn/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">注册华为开发者帐号</a>。</p>
81</td>
82</tr>
83</tbody>
84</table>
85
86## 安装Visual Studio Code<a name="zh-cn_topic_0000001058091994_section71401018163318"></a>
87
88>![](../public_sys-resources/icon-note.gif) **说明:**
89>如果已安装Visual Studio Code,打开命令行工具,输入**code --version**命令,检查版本号是否为1.53及以上版本;可以正常返回版本号,说明环境变量设置也正确。
90
911.  双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。
92
93    ![](figure/installing-visual-studio-code.png)
94
952.  安装完成后,打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。
96
97## 安装Python<a name="zh-cn_topic_0000001058091994_section16266553175320"></a>
98
991.  双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。
100
101    ![](figure/installing-python.png)
102
1032.  等待安装完成后,点击**Close**。
104
105    ![](figure/setup-was-successful.png)
106
1073.  打开命令行工具,输入python --version,检查安装结果。
108
109    ![](figure/checking-the-installation-result.png)
110
1114.  在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。
112
113    ```
114    pip config set global.trusted-host repo.huaweicloud.com
115    pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple
116    pip config set global.timeout 120
117    ```
118
119
120## 安装Node.js<a name="zh-cn_topic_0000001058091994_section5353233124511"></a>
121
122>![](../public_sys-resources/icon-note.gif) **说明:**
123>如果已安装Node.js,打开命令行工具,输入**node -v**命令,检查版本号是否为12.0.0及以上版本。
124
1251.  点击下载后的软件包进行安装,全部按照默认设置点击**Next**,直至**Finish**。安装过程中,Node.js会自动在系统的path环境变量中配置node.exe的目录路径。
1262.  重新打开命令行工具,输入“node -v“命令,能正常查询Node.js的版本号,说明Node.js安装成功。
127
128## 安装hpm<a name="zh-cn_topic_0000001058091994_section173054793610"></a>
129
130该方式需先确保**Node.js**安装成功。
131
132在安装hpm前,请检查网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问。这种情况下,需要先[设置npm代理](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032),才能安装hpm。
133
134>![](../public_sys-resources/icon-note.gif) **说明:**
135>如果已安装hpm,可以执行**npm update -g @ohos/hpm-cli**命令升级hpm至最新版本。
136
1371.  建议将npm源配置为国内镜像,例如设置为华为云镜像源。
138
139    ```
140    npm config set registry https://repo.huaweicloud.com/repository/npm/
141    ```
142
1432.  打开命令行工具,执行如下命令安装最新版本hpm。
144
145    ```
146    npm install -g @ohos/hpm-cli
147    ```
148
149    ![](figure/hpm-version.png)
150
1513.  安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。
152
153    ```
154    hpm -V
155    ```
156
157
158## 安装DevEco Device Tool插件<a name="zh-cn_topic_0000001058091994_section4336315185716"></a>
159
160安装DevEco Device Tool插件,**主机的用户名不能包含中文字符**,否则在运行DevEco Device Tool时,DevEco Home界面会一直处于Loading状态,导致不能正常使用。
161
162DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144)163
164>![](../public_sys-resources/icon-note.gif) **说明:**
165>安装DevEco Device Tool时,请先关闭Visual Studio Code。
166
1671.  解压DevEco Device Tool插件压缩包,双击安装包程序进行安装。
1682.  DevEco Device Tool会检测安装依赖的工具包是否符合要求。如果不符合要求,请按照本章节前面的内容进行安装。
169
170    >![](../public_sys-resources/icon-note.gif) **说明:**
171    >如果已经安装Visual Studio Code,但依然检测不到,可重启电脑解决。
172
173    ![](figure/installing-the-deveco-device-tool.png)
174
1753.  点击**Install**进行安装。
176
177    ![](figure/install.png)
178
1794.  等待安装完成后,点击Close关闭安装界面。
180
181    ![](figure/installation-complete.png)
182
1835.  启动Visual Studio Code,会自动安装DevEco Device Tool依赖的C/C++、CodeLLDB插件。等待安装完成后,点击Visual Studio Code左侧的![](figure/button.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。
184
185    >![](../public_sys-resources/icon-note.gif) **说明:**
186    >如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)187
188    ![](figure/visual-studio-code.png)
189
190
191