打开主菜单

Wiki-Orange Pi β

更改

Orange Pi 5 Plus

添加3,299字节, 2023年6月2日 (五) 17:22
Debian Bullseye系统
</li></ol>
</li></ol>
 
=== Debian Bookworm系统 ===
 
<ol style="list-style-type: decimal;">
<li><p>Debian Bookworm默认安装有gcc编译工具链,可以直接在开发板的Linux系统中编译C语言的程序</p>
<ol style="list-style-type: lower-alpha;">
<li><p>gcc的版本如下所示</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc --version'''</p>
<p>gcc (Debian 12.2.0-14) 12.2.0</p>
<p>Copyright (C) 2020 Free Software Foundation, Inc.</p>
<p>This is free software; see the source for copying conditions. There is NO</p>
<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
|}
</li>
<li><p>编写C语言的'''hello_world.c'''程序</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.c'''</p>
<p>#include &lt;stdio.h&gt;</p>
 
<p>int main(void)</p>
<p>{</p>
::<p>printf(&quot;Hello World!\n&quot;);</p>
 
::<p>return 0;</p>
<p>}</p>
|}
</li>
<li><p>然后编译运行'''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li>
<li><p>Debian Bookworm默认安装有Python3</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Python具体版本如下所示</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3'''</p>
<p>'''Python 3.11.2''' (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p>
<p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>
<p>&gt;&gt;&gt;</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''使用Ctrl+D快捷键可退出python的交互模式。'''</p></big>
|}
</li>
<li><p>编写Python语言的'''hello_world.py'''程序</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>
<p>print('Hello World!')</p>
|}
</li>
<li><p>运行'''hello_world.py'''的结果如下所示</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li>
<li><p>Debian Bookworm默认没有安装Java的编译工具和运行环境</p>
<ol style="list-style-type: lower-alpha;">
<li><p>可以使用下面的命令安装openjdk,Debian Bookworm中最新版本为openjdk-17</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>
|}
</li>
<li><p>安装完后可以查看下Java的版本</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''java --version'''</p>
|}
</li>
<li><p>编写Java版本的'''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>
<p>public class hello_world</p>
<p>{</p>
::<p>public static void main(String[] args)</p>
::<p>{</p>
::::<p>System.out.println(&quot;Hello World!&quot;);</p>
::<p>}</p>
<p>}</p>
|}
</li>
<li><p>然后编译运行'''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''javac hello_world.java'''</p>
<p>orangepi@orangepi:~$ '''java hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li></ol>
 
<span id="ubuntu-focal系统"></span>
8,460
个编辑