8,367
edits
Changes
→3.17.1. How to install wiringOP-Python
<span id="how-to-install-wiringop-python"></span>
=== 3.17.1. How to install wiringOP-Python ===
# First install the dependent packages
::{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''sudo apt-get update'''
root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Then use the following command to download the source code of wiringOP-Python</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 that the download process does not report errors due to network problems.''' '''If you have problems downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image, and the storage location is:/usr/src/wiringOP-Python'''.
'''If you have problems downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image, and 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>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''cd wiringOP-Python'''
root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then enter the following command, if there is help information output, it means that wiringOP-Python is installed successfully, press the q key to exit the help information interface</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
: #Version 4.0.2
: # Do not make changes to this file unless you know what you are doing--modify
: # the SWIG interface Do not make changes to this file instead.unless you know what you are doing--modify
: # the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>The steps to test whether wiringOP-Python is successfully installed 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
: #
: # Do not make changes to this file unless you know what you are doing--modify : # the SWIG interface file instead.
CLASSES
:builtins.object
::GPIO
::I2C
::Serial
::nes
:class GPIO(builtins.object) :| GPIO(pinmode=0) :|
>>>
|}
</ol>
</li></ol>
<span id="pin-gpio-port-test-1"></span>
=== 40pin GPIO port test ===