问题描述
安装python后,再使用python执行脚本时,报了下面的错误:
manim -pql ~/Desktop/manim/Untitled-1.py CreateCircle Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "D:ProgramspythonScriptsmanim.exe\__main__.py", line 4, in <module> File "D:ProgramspythonLibsite-packagesmanim\__init__.py", line 6, in <module> import pkg_resources ModuleNotFoundError: No module named 'pkg_resources'
问题分析
Python 执行脚本时出现问题:
解决方案
既然 setuptools 模块找不到,就使用pip进行安装
pip install --upgrade setuptools Collecting setuptools Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/55/3a/5121b58b578a598b269537e09a316ad2a94fdd561a2c6eb75cd68578cc6b/setuptools-69.0.3-py3-none-any.whl.metadata Using cached setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB) Using cached setuptools-69.0.3-py3-none-any.whl (819 kB) Installing collected packages: setuptools Successfully installed setuptools-69.0.3
安装完成后,一般问题就消失了。
如果问题仍未消失,卸载遗留的版本后重新安装。
pip uninstall -y setuptools # then install again pip install setuptools
如果上面的执行不能正常执行,则尝试升级pip, setuptools, 和wheel到最新的版本。(!!!慎重,因为升级后可能造成一些依赖旧版本的脚本不能工作)
python -m pip install --upgrade pip setuptools wheel