解释下这段报错内容C:\Program Files\JetBrains\PyCharm 2021.3.1\plugins\python\helpers\pycharm\_jb_pytest_runner.py:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import
时间: 2023-08-12 17:10:34 浏览: 760
这段报错内容是在运行 PyCharm 的 pytest_runner.py 文件时出现的。报错信息指出,使用 pkg_resources 模块的方式已被标记为过时(DeprecationWarning)并且不再推荐使用。pkg_resources 是一个用于处理 Python 包和资源的工具,但现在官方推荐使用 setuptools 库来代替它。
建议你查看给出的链接,了解如何使用 setuptools 来替代 pkg_resources,以解决这个问题。
相关问题
E:\visualization\analysis\1.py:80: MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later. plt.show() C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 21508 (\N{CJK UNIFIED IDEOGRAPH-5404}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 20010 (\N{CJK UNIFIED IDEOGRAPH-4E2A}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 26376 (\N{CJK UNIFIED IDEOGRAPH-6708}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 20221 (\N{CJK UNIFIED IDEOGRAPH-4EFD}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 30340 (\N{CJK UNIFIED IDEOGRAPH-7684}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 38144 (\N{CJK UNIFIED IDEOGRAPH-9500}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 21806 (\N{CJK UNIFIED IDEOGRAPH-552E}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 24773 (\N{CJK UNIFIED IDEOGRAPH-60C5}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 20917 (\N{CJK UNIFIED IDEOGRAPH-51B5}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 36135 (\N{CJK UNIFIED IDEOGRAPH-8D27}) missing from current font. FigureCanvasAgg.draw(self) C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 21697 (\N{CJK UNIFIED IDEOGRAPH-54C1}) missing from current font. FigureCanvasAgg.draw(self) Process finished with exit code 0
这是一些Matplotlib的警告信息。其中第一条警告表示,Matplotlib 3.6版本开始不再支持没有“required_interactive_framework”属性的FigureCanvases,这个属性用于指定绘图所需的交互式框架。如果你的代码中使用了这样的FigureCanvas,建议更新Matplotlib版本或修改代码以使用最新的FigureCanvas。
其他的警告则是指出当前字体中缺少一些中文字符,这可能会影响绘图结果的显示效果。可以通过更换字体或安装支持中文字符的字体来解决这个问题。
这些警告信息并不会影响代码的运行,只是提醒你可能需要注意一些绘图的细节问题。建议在代码中加入以下语句来禁止警告的输出:
```
import warnings
warnings.filterwarnings("ignore")
```
rom tensorflow.keras.preprocessing.sequence import pad_sequences Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\keras\api\_v2\keras\__init__.py", line 13, in <module> from keras.api._v2.keras import __internal__ File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\keras\api\__init__.py", line 8, in <module> from keras.api import keras File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\keras\api\keras\__init__.py", line 13, in <module> from keras.api.keras import __internal__ File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\keras\api\keras\__internal__\__init__.py", line 10, in <module> from keras.saving.serialization_lib import enable_unsafe_deserialization File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Program Files\Python310\lib\site-packages\keras\saving\serialization_lib.py", line 28, in <module> from keras.saving.legacy.saved_model.utils import in_tf_saved_model_scope ImportError: cannot import name 'in_tf_saved_model_scope' from 'keras.saving.legacy.saved_model.utils' (C:\Program Files\Python310\lib\site-packages\keras\saving\legacy\saved_model\utils.py)
这个错误可能是因为您的 Keras 版本太新或太旧。 `in_tf_saved_model_scope` 函数是 Keras 2.3.0 版本中引入的。建议您检查您的 Keras 版本是否为 2.3.0 或更高版本。如果您的版本太新,则可以尝试回退到 2.3.0 版本或更低版本,或者更新您的代码以适应新版本的 Keras。如果您的版本太旧,则可以尝试升级到 2.3.0 版本或更高版本。
您可以使用以下命令升级 Keras:
```
pip install --upgrade keras
```
如果您已经安装了最新版本的 Keras,但仍然遇到此错误,请尝试使用以下命令卸载并重新安装 Keras:
```
pip uninstall keras
pip install keras==2.3.0
```
如果这些步骤仍然无法解决问题,请检查您的代码是否正确导入了所需的 Keras 模块。如果您正在使用 PyCharm 等 IDE,请确保您的项目解释器已正确配置。
阅读全文
相关推荐
















