【问题标题】:Setting up an Odoo 12 developer environment, Issues with Werkzeug version设置 Odoo 12 开发者环境,Werkzeug 版本的问题
【发布时间】:2020-04-01 16:53:24
【问题描述】:

我正在尝试使用 Pycharm 在 Ubuntu 版本 18.04 上使用 Python 3.7 virtualenv 设置 Odoo 12 实例。我不断收到与 Werkzeug 相关的问题,如下所示:

如果我使用写在 requirements.txt 文件中的所需版本的 werkzueg (Werkzeug==0.11.15),我会收到此错误。我认为这个错误来自 werkzueg 的版本不支持 Python 3.7

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/http.py", line 26, in <module>
    from urllib2 import parse_http_list as _parse_list_header
ModuleNotFoundError: No module named 'urllib2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/datastructures.py", line 2700, in <module>
    from werkzeug.http import dump_options_header, dump_header, generate_etag, \
ImportError: cannot import name 'dump_options_header' from 'werkzeug.http' (/usr/local/lib/python3.7/dist-packages/werkzeug/http.py)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/http.py", line 26, in <module>
    from urllib2 import parse_http_list as _parse_list_header
ModuleNotFoundError: No module named 'urllib2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/http.py", line 28, in <module>
    from urllib.request import parse_http_list as _parse_list_header
ImportError: cannot import name 'parse_http_list' from 'urllib.request' (/usr/lib/python3.7/urllib/request.py)

Original exception was:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/http.py", line 26, in <module>
    from urllib2 import parse_http_list as _parse_list_header
ModuleNotFoundError: No module named 'urllib2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/datastructures.py", line 2700, in <module>
    from werkzeug.http import dump_options_header, dump_header, generate_etag, \
ImportError: cannot import name 'dump_options_header' from 'werkzeug.http' (/usr/local/lib/python3.7/dist-packages/werkzeug/http.py)

Process finished with exit code 1

如果我使用最新版本的 werkzueg (Werkzeug==1.0.1),我会收到此错误。

Traceback (most recent call last):

  File "/home/alexvining/Documents/Odoo Dev Env/Odoo 12/odoo/odoo/http.py", line 32, in <module>
    import werkzeug.contrib.sessions
ModuleNotFoundError: No module named 'werkzeug.contrib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 61, in <module>
    import SocketServer as socketserver
ModuleNotFoundError: No module named 'SocketServer'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 58, in <module>
    from http.server import BaseHTTPRequestHandler
ModuleNotFoundError: No module named 'http.server'; 'http' is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 61, in <module>
    import SocketServer as socketserver
ModuleNotFoundError: No module named 'SocketServer'

Original exception was:

  File "/home/alexvining/Documents/Odoo Dev Env/Odoo 12/odoo/odoo/http.py", line 32, in <module>
    import werkzeug.contrib.sessions
ModuleNotFoundError: No module named 'werkzeug.contrib'

During handling of the above exception, another exception occurred:

  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 61, in <module>
    import SocketServer as socketserver
ModuleNotFoundError: No module named 'SocketServer'

Process finished with exit code 1

对不起,我不得不缩短错误日志,堆栈溢出给我一个错误,说邮件看起来像垃圾邮件。 任何帮助将不胜感激!

【问题讨论】:

    标签: python odoo urllib2 werkzeug socketserver


    【解决方案1】:

    werkzeug.contrib 在 v1.0.0 中被移除。

    将 requirements.txt 条目更改为

    werkzeug==0.16.1
    

    会起作用的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-07
      • 1970-01-01
      • 2021-03-22
      • 2010-10-24
      • 1970-01-01
      • 2014-10-28
      • 1970-01-01
      • 2018-10-04
      相关资源
      最近更新 更多