请我需要帮助,我尝试从pycharm运行odoo,我已经在ubuntu 18.04机器上安装了odoo 12,我已经在pycharm中打开了odoo文件夹,并在pycharm中添加了配置(我使用pycharm communoty版)到这个已打开的项目中,之后我运行odoo,但是无法从pycharm运行odoo,并且出现此错误:
/usr/bin/python3.6 /usr/bin/odoo
/usr/local/lib/python3.6/dist-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 32, in <module>
from werkzeug.datastructures import CallbackDict
File "/usr/local/lib/python3.6/dist-packages/werkzeug/datastructures.py", line 2759, in <module>
from werkzeug.http import dump_options_header, dump_header, generate_etag, \
ImportError: cannot import name 'dump_options_header'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/odoo", line 5, in <module>
import odoo
File "/usr/lib/python3/dist-packages/odoo/__init__.py", line 89, in <module>
from . import modules
File "/usr/lib/python3/dist-packages/odoo/modules/__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "/usr/lib/python3/dist-packages/odoo/modules/graph.py", line 10, in <module>
import odoo.tools as tools
File "/usr/lib/python3/dist-packages/odoo/tools/__init__.py", line 9, in <module>
import werkzeug.utils
File "/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py", line 151, in <module>
__import__('werkzeug.exceptions')
File "/usr/local/lib/python3.6/dist-packages/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 27, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "/usr/local/lib/python3.6/dist-packages/werkzeug/http.py", line 30, in <module>
from urllib2 import parse_http_list as _parse_list_header, \
ModuleNotFoundError: No module named 'urllib2'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/werkzeug/http.py", line 27, in <module>
from urllib.request import parse_http_list as _parse_list_header
ImportError: cannot import name 'parse_http_list'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
from urllib.request import urlopen
File "/usr/lib/python3.6/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3/dist-packages/odoo/http.py", line 32, in <module>
import werkzeug.contrib.sessions
File "/usr/local/lib/python3.6/dist-packages/werkzeug/contrib/sessions.py", line 63, in <module>
from werkzeug.datastructures import CallbackDict
File "/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py", line 151, in <module>
__import__('werkzeug.exceptions')
File "/usr/local/lib/python3.6/dist-packages/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 27, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "/usr/local/lib/python3.6/dist-packages/werkzeug/http.py", line 30, in <module>
from urllib2 import parse_http_list as _parse_list_header, \
ModuleNotFoundError: No module named 'urllib2'
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/werkzeug/http.py", line 27, in <module>
from urllib.request import parse_http_list as _parse_list_header
File "/usr/lib/python3.6/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3/dist-packages/odoo/http.py", line 32, in <module>
import werkzeug.contrib.sessions
File "/usr/local/lib/python3.6/dist-packages/werkzeug/contrib/sessions.py", line 63, in <module>
from werkzeug.datastructures import CallbackDict
File "/usr/local/lib/python3.6/dist-packages/werkzeug/datastructures.py", line 2759, in <module>
from werkzeug.http import dump_options_header, dump_header, generate_etag, \
ImportError: cannot import name 'dump_options_header'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/odoo", line 5, in <module>
import odoo
File "/usr/lib/python3/dist-packages/odoo/__init__.py", line 89, in <module>
from . import modules
File "/usr/lib/python3/dist-packages/odoo/modules/__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "/usr/lib/python3/dist-packages/odoo/modules/graph.py", line 10, in <module>
import odoo.tools as tools
File "/usr/lib/python3/dist-packages/odoo/tools/__init__.py", line 9, in <module>
from .misc import *
File "/usr/lib/python3/dist-packages/odoo/tools/misc.py", line 26, in <module>
import werkzeug.utils
File "/usr/local/lib/python3.6/dist-packages/werkzeug/__init__.py", line 151, in <module>
__import__('werkzeug.exceptions')
File "/usr/local/lib/python3.6/dist-packages/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 27, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "/usr/local/lib/python3.6/dist-packages/werkzeug/http.py", line 30, in <module>
from urllib2 import parse_http_list as _parse_list_header, \
ModuleNotFoundError: No module named 'urllib2'
Process finished with exit code 1
答案 0 :(得分:0)
pycharm odoo实例使用/usr/bin/python3.6
作为其python
解释器,此python环境不包含运行odoo-12
实例的必要程序包。强烈建议使用虚拟环境,而不是系统范围的环境。
要安装运行odoo-12
所需的软件包,请使用odoo git中的pip和requirements.txt。只需下载文本文件并运行以下命令:
python3.6 -m pip install -r requirements.txt
如果找不到pip
软件包,则可以使用以下命令从apt
存储库中安装它
sudo apt-get install python3-pip