目录
- 一、问题呈现
- 二、问题原因及解决办法
- 三、处理结果
一、问题呈现
在初次运行ReactPy报错raise RuntimeError("No built-in server implementation installed.") RuntimeError: No built-in server implementation installed.
具体报错信息如下:
D:\install\develop\Anaconda3\envs\py37\Scripts\python.exe D:\Datas\CodeDate\PythonCode\ReactPy-Web-test\src\common\test-web.py
2023-06-14T09:53:18+0800 | WARNING | The `run()` function is only intended for testing during development! To run in production, consider selecting a supported backend and importing its associated `configure()` function from `reactpy.backend.<package>` where `<package>` is one of ['starlette', 'fastapi', 'sanic', 'tornado', 'flask']. For details refer to the docs on how to run each package.
Traceback (most recent call last):
File "D:\install\develop\Anaconda3\envs\py37\lib\site-packages\reactpy\backend\default.py", line 59, in _default_implementation
implementation = next(all_implementations())
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Datas\CodeDate\PythonCode\ReactPy-Web-test\src\common\test-web.py", line 7, in <module>
run(hello_world)
File "D:\install\develop\Anaconda3\envs\py37\lib\site-packages\reactpy\backend\utils.py", line 37, in run
app = implementation.create_development_app()
File "D:\install\develop\Anaconda3\envs\py37\lib\site-packages\reactpy\backend\default.py", line 28, in create_development_app
return _default_implementation().create_development_app()
File "D:\install\develop\Anaconda3\envs\py37\lib\site-packages\reactpy\backend\default.py", line 62, in _default_implementation
raise RuntimeError("No built-in server implementation installed.")
RuntimeError: No built-in server implementation installed.
截图如下
二、问题原因及解决办法
去百度并没有找到相关解释,所这里我就记录一下,供后来人参考
针对这个问题,我排查了一点点时间,最后在ReactPy开发官网找到了问题的原因。
先上ReactPy开发官网地址:https://reactpy.dev/docs/guides/getting-started/index.html
在页面中有这样一句话:
大概意思是说,安装ReactPy的同时还需要安装一个支持ReactPy的服务器–这里推荐starlette,安装命令如下:
pip install "reactpy[starlette]"
ps:
报错的原因就是我直接只安装了ReactPy,而没有安装服务器,为此出现了问题,所以大家这里记得一定要用这个命令进行安装:pip install "reactpy[starlette]"
。
三、处理结果
然后在运行就可以成功啦,成功相关截图如下: