感谢电子发烧友william hill官网
和芒果派。上次介绍了环境的安装,这次来尝试一下Python编程。本次评测本来的目标就是用开发板连接讯飞星火大数据模型,讯飞星火提供的接口是Python的,而芒果派MQ Pro安装有完整的Python 3,正好可以测试一下。
把讯飞星火提供的示例程序运行了一下,发现缺少Websocket库,结果发现板子上并没有安装pip,所以先需要安装pip:
sudo apt-get install python3-pip
接下来安装websocket,使用如下命令:
pip install websocket
结果发现在pip的仓库中虽然有websocket的库,但是安装该库的时候需要使用C语言进行编译,所以还需要安装python3-dev,使用如下命令:
sudo apt-get install python3-dev
安装完python3-dev,再次执行pip install websocket命令,经过了漫长的等待之后遇到了如下错误:
root@nezha:~# pip install websocket
Collecting websocket
Using cached websocket-0.2.1.tar.gz (195 kB)
Preparing metadata (setup.py) ... done
Collecting gevent
Using cached gevent-22.10.2.tar.gz (6.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
×
Preparing metadata (pyproject.toml) did not run successfully.
│
exit code: 1
╰─> [38 lines of output]
Traceback (most recent call last):
File
"/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py",
line 363, in <module>
main()
File
"/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py",
line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File
"/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py",
line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File
"/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 174,
in prepare_metadata_for_build_wheel
self.run_setup()
File
"/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158,
in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 496, in <module>
run_setup(EXT_MODULES)
File "setup.py", line 362, in run_setup
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py",
line 153, in setup
return distutils.core.setup(**attrs)
File
"/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line
109, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line
459, in __init__
_Distribution.__init__(
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py",
line 293, in __init__
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line
837, in finalize_options
ep(self)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line
858, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File
"/tmp/pip-build-env-iexz875m/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py",
line 219, in cffi_modules
add_cffi_module(dist, cffi_module)
File
"/tmp/pip-build-env-iexz875m/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py",
line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "/tmp/pip-build-env-iexz875m/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py",
line 25, in execfile
exec(code, glob, glob)
File "src/gevent/libev/_corecffi_build.py", line 31, in
<module>
ffi = FFI()
File "/tmp/pip-build-env-iexz875m/overlay/local/lib/python3.10/dist-packages/cffi/api.py",
line 54, in __init__
raise Exception("Version mismatch: this is the 'cffi' package
version %s, located in %r. When we
import the top-level '_cffi_backend' extension module, we get version %s,
located in %r. The two versions should
be equal; check your installation." % (
Exception: Version mismatch: this is the 'cffi' package version 1.15.1,
located in
'/tmp/pip-build-env-iexz875m/overlay/local/lib/python3.10/dist-packages/cffi/api.py'. When we import the top-level '_cffi_backend'
extension module, we get version 1.15.0, located in
'/usr/lib/python3/dist-packages/_cffi_backend.cpython-310-riscv64-linux-gnu.so'. The two versions should be equal; check your
installation.
[end of output]
note: This error originates from a subprocess, and is likely not a
problem with pip.
error: metadata-generation-failed
× Encountered error while generating
package metadata.
╰─> See above for output.
note: This is an issue with the package
mentioned above, not pip.
hint: See above for details.
显然,安装脚本存在问题。最后只好放弃本次测评的计划了。结合这几天测试的结果,感觉虽然RISC-V生态已经有了很大的进步,不过因为关注的人不多,还有很多问题需要解决。