Preparing Software
Make sure the following procedures are performed:
Note: The python project, VisionFive.gpio, is
applicable for VisionFive, VisionFive 2 and JH7110 EVB.
- Flash Debian OS into a Micro-SD card as described in the Flashing Fedora OS to a Micro-SD Card section in the VisionFive 2 Single Board Computer Quick Start Guide.
- Log into the Debian and make sure VisionFive 2 is connected to the Internet. For detailed instructions, refer to the Using SSH over Ethernet or Using a USB to Serial Converter section in the VisionFive 2 Single Board Computer Quick Start Guide.
- Extend the partition on Debian as described in Extend Partition in the VisionFive 2 Single Board Computer Quick Start Guide.
- Execute the following command to install PIP on Debian:
apt-get install python3-pip
- Execute the
pip
command on VisionFive 2 Debian to install the VisionFive.gpio package:Note: Due to the fact that pypi.org official website does not yet support uploading whl installation packages for the RISC-V platform, so it cannot directly executepip install VisionFive.gpio
command to install online.Please follow the steps below to install the VisionFive.gpio package.
- Execute the following command to install dependent
package:
apt install libxml2-dev libxslt-dev python3 -m pip install requests wget bs4
- Execute the following command to run the installation script
Install_VisionFive_gpio.py
:python3 Install_VisionFive_gpio.py
The installation script codes are as follows:import requests import wget import sys import os from bs4 import BeautifulSoup def parse_data(link_addr, class_type, key_str): req = requests.get(url=link_addr) req.encoding = "utf-8" html=req.text soup = BeautifulSoup(req.text,features="html.parser") package_version = soup.find(class_type,class_=key_str) dd = package_version.text.strip() data = dd.split() return data def parse_link(link_addr, class_type, key_str): req = requests.get(url=link_addr) req.encoding = "utf-8" html=req.text soup = BeautifulSoup(req.text,features="html.parser") search_data = soup.find(class_type,class_=key_str) search_data_2 = search_data.find("a") dl_link_get = search_data_2.get("href") return dl_link_get def get_dl_addr_page(): link_address = "https://pypi.org/project/VisionFive.gpio/#history" key_str = "release__version" class_key = "p" data_get = parse_data(link_address, class_key, key_str) latest_version = data_get[0] dl_addr_page = "https://pypi.org/project/VisionFive.gpio/{}/#files".format(latest_version) return dl_addr_page def get_dl_addr_of_latest_version(link_addr): key_str = "card file__card" class_key = "div" addr_get = parse_link(link_addr, class_key, key_str) return addr_get def main(): dl_addr_p = get_dl_addr_page() whl_dl_addr = get_dl_addr_of_latest_version(dl_addr_p) whl_name = whl_dl_addr.split("/")[-1] whl_name_suffix = os.path.splitext(whl_name)[-1] whl_name_prefix = os.path.splitext(whl_name)[0] whl_name_prefix_no_platform = whl_name_prefix[0: len(whl_name_prefix) - 3] new_platform = "linux_riscv64" rename_whl_name = "{}{}{}".format(whl_name_prefix_no_platform, new_platform, whl_name_suffix) wget.download(whl_dl_addr, out=rename_whl_name) os.system("pip install " + rename_whl_name) os.system("rm -rf " + rename_whl_name) if __name__ == '__main__': sys.exit(main())
- Execute the following command to install dependent
package: