[已解决]ImportError: No module named passlib.utils
-
回复: MacOS安装odoo失败提示No module named passlib.utils
首先我用的是ubuntu系统。
单独启动odoo服务没问题的,但是如果配置到pycharm里面的话启动就会报错如下,我的配置的python的如图,有问题不?
python环境配置如下:
报错如下:Traceback (most recent call last): File "/home/hui/odoo-dev/odoo10/odoo/odoo-bin", line 5, in <module> __import__('pkg_resources').declare_namespace('odoo.addons') File "/home/hui/odoo-dev/odoo10/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2267, in declare_namespace declare_namespace(parent) File "/home/hui/odoo-dev/odoo10/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2283, in declare_namespace _handle_ns(packageName, path_item) File "/home/hui/odoo-dev/odoo10/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2218, in _handle_ns loader.load_module(packageName) File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module mod = imp.load_module(fullname, self.file, self.filename, self.etc) File "/home/hui/odoo-dev/odoo10/odoo/odoo/__init__.py", line 60, in <module> import modules File "/home/hui/odoo-dev/odoo10/odoo/odoo/modules/__init__.py", line 8, in <module> from . import db, graph, loading, migration, module, registry File "/home/hui/odoo-dev/odoo10/odoo/odoo/modules/graph.py", line 13, in <module> import odoo.osv as osv File "/home/hui/odoo-dev/odoo10/odoo/odoo/osv/__init__.py", line 4, in <module> import osv File "/home/hui/odoo-dev/odoo10/odoo/odoo/osv/osv.py", line 4, in <module> from ..exceptions import except_orm File "/home/hui/odoo-dev/odoo10/odoo/odoo/exceptions.py", line 15, in <module> from tools.func import frame_codeinfo File "/home/hui/odoo-dev/odoo10/odoo/odoo/tools/__init__.py", line 8, in <module> from misc import * File "/home/hui/odoo-dev/odoo10/odoo/odoo/tools/misc.py", line 16, in <module> import passlib.utils ImportError: No module named passlib.utils
-
@hui
这个pycharm是2017.3版本的,较我以前使用的一个版本,一个新的改变就是在哪个项目下选择编译环境的话,pycharm会自动创建一个虚拟环境,然后自动识别这个虚拟的环境。问题来了,这个python中只有几个lib,所以导致启动odoo总是报缺少包。解决1:使用ubuntu系统自带的python2.7,如果使用的python2的话,在pycharm中新建一个环境,选择系统自带的,如下图,就解决了:
解决2:pycharm中有自带的可以安装的lib的,可以找到选择的python,然后一个一个安装。(我只安装了几个,不过测试是可行的,但是不知道如何批量安装,否则就是报缺少哪个lib就安装哪个有点麻烦。)
pycharm中自动生成的虚拟环境用source命令进不去,所以也就不能在虚拟环境下使用pip安装了。