8,367
edits
Changes
→How to install wiringOP-Python
<ol style="list-style-type: decimal;">
<li><p>First install dependency packages</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''sudo apt-get update'''</p>
<p>root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </olbig> '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.''' If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: '''/usr/src/wiringOP-Python'''
If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: '''/usr/src/wiringOP-Python'''</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''
root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''cd wiringOP-Python'''</p>
<p>root@orangepi:~/wiringOP-Python# '''python3 generate-bindings.py > bindings.i'''</p>
<p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p>|}</li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''q''' key to exit the help information interface.</p></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; help(wiringpi)"'''
Help on module wiringpi:
NAME
:wiringpi
DESCRIPTION
: # This file was automatically generated by SWIG (http://www.swig.org).
: # Version 4.0.2
: #
: # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead.
: # the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>First use the python3 command to enter the command line mode of > python3</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''python3'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then import the python module of wiringpi</li></ol>{| class="wikitable" style="width:800px;" |-|
>>> '''import wiringpi;'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Finally, enter the following command to view the help information of > wiringOP-Python. Press the q key to exit the help information > interface.</li></ol>{| class="wikitable" style="width:800px;" |-|
>>> '''help(wiringpi)'''
Help on module wiringpi:
NAME
:wiringpi
DESCRIPTION
: # This file was automatically generated by SWIG (http://www.swig.org). : # Version 4.0.2
: # Version 4.0.2
: #Do not make changes to this file unless you know what you are doing--modify
: # Do not make changes to this the SWIG interface file unless you know what you are doing--modifyinstead.
CLASSES
:builtins.object ::GPIO
:class GPIO(builtins.object)
:| GPIO(pinmode=0) :|
>>>
|}
</ol>
</li></ol>
<span id="pin-gpio-port-test-1"></span>
=== 40pin GPIO port test ===