解决:ModuleNotFoundError: No module named ‘exceptions’

Traceback (most recent call last):
  File "/Users/amos/Documents/env37/lib/python3.7/site-packages/werkzeug/serving.py", line 306, in run_wsgi
    execute(self.server.app)
  File "/Users/amos/Documents/env37/lib/python3.7/site-packages/werkzeug/serving.py", line 294, in execute
    application_iter = app(environ, start_response)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/service/server.py", line 441, in app
    return self.app(e, s)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/service/wsgi_server.py", line 113, in application
    return application_unproxied(environ, start_response)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/service/wsgi_server.py", line 88, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/http.py", line 1307, in __call__
    return self.dispatch(environ, start_response)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/http.py", line 1273, in __call__
    return self.app(environ, start_wrapped)
  File "/Users/amos/Documents/env37/lib/python3.7/site-packages/werkzeug/middleware/shared_data.py", line 220, in __call__
    return self.app(environ, start_response)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/http.py", line 1501, in dispatch
    response = self.get_response(httprequest, result, explicit_session)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/http.py", line 283, in __exit__
    elif self.registry:
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/http.py", line 379, in registry
    return odoo.registry(self.db)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/registry.py", line 65, in __new__
    return cls.new(db_name)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/loading.py", line 457, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/loading.py", line 349, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/loading.py", line 179, in load_module_graph
    load_openerp_module(package.name)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/odoo/modules/module.py", line 385, in load_openerp_module
    __import__('odoo.addons.' + module_name)
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/lims/lims_report/__init__.py", line 1, in <module>
    from . import models
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/lims/lims_report/models/__init__.py", line 2, in <module>
    from . import lims_analysis_report
  File "/Users/amos/Documents/Gitee/Company/odoo-14.0+e.20220411/lims/lims_report/models/lims_analysis_report.py", line 5, in <module>
    from docx import Document
  File "/Users/amos/Documents/env37/lib/python3.7/site-packages/docx.py", line 30, in <module>
    from exceptions import PendingDeprecationWarning
ModuleNotFoundError: No module named 'exceptions' - - -

解决方法
要解决这个错误,需要安装python-docx模块,卸载掉docx模块。

卸载docx模块的命令如下:

pip uninstall docx
安装python-docx模块的命令如下:

pip install python-docx

(env37) amos@wangguangjiandeMacBook-Pro odoo-14.0+e.20220411 % pip install python-docx
-i https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting python-docx
  Using cached python_docx-1.1.2-py3-none-any.whl.metadata (2.0 kB)
Requirement already satisfied: lxml>=3.1.0 in /Users/amos/Documents/env37/lib/python3.7/site-packages (from python-docx) (4.3.2)
INFO: pip is looking at multiple versions of python-docx to determine which version is compatible with other requirements. This could take a while.
  Using cached python_docx-1.1.1-py3-none-any.whl.metadata (2.0 kB)
  Using cached python_docx-1.1.0-py3-none-any.whl.metadata (2.0 kB)
Requirement already satisfied: typing-extensions in /Users/amos/Documents/env37/lib/python3.7/site-packages (from python-docx) (4.7.1)
Downloading python_docx-1.1.0-py3-none-any.whl (239 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 239.6/239.6 kB 140.4 kB/s eta 0:00:00
Installing collected packages: python-docx
Successfully installed python-docx-1.1.0

猜你喜欢

转载自blog.csdn.net/qq_70140795/article/details/140204364