我在安装好了具有cli特性的rembg后,也确定把终端路径切换到桌面后,在终端输入rembg i test.jpg output.png
此处的"test.jpg"是桌面上真实存在的一个jpg格式的图片,且桌面上不存在名叫"output.png"的图片
终端却输出Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/rembg", line 8, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rembg/cli.py", line 23, in main
from .commands import command_functions
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rembg/commands/__init__.py", line 9, in <module>
module = import_module(f"{__name__}.{module_name}")
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rembg/commands/s_command.py", line 8, in <module>
import gradio as gr
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/__init__.py", line 3, in <module>
import gradio._simple_templates
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/_simple_templates/__init__.py", line 1, in <module>
from .simpledropdown import SimpleDropdown
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/_simple_templates/simpledropdown.py", line 6, in <module>
from gradio.components.base import FormComponent
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/components/__init__.py", line 1, in <module>
from gradio.components.annotated_image import AnnotatedImage
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/components/annotated_image.py", line 12, in <module>
from gradio.components.base import Component
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/components/base.py", line 21, in <module>
from gradio.blocks import Block, BlockContext
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/blocks.py", line 29, in <module>
from gradio import (
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/networking.py", line 20, in <module>
from gradio.routes import App
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gradio/routes.py", line 114, in <module>
templates = Jinja2Templates(directory=STATIC_TEMPLATE_LIB)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/templating.py", line 110, in __init__
self._setup_env_defaults(self.env)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/templating.py", line 126, in _setup_env_defaults
context: typing.Dict[str, typing.Any],
SystemError: no locals when loading 'str
这是为什么,怎么解决,正确输出图片 |