无法在 Mac OS X 中正确运行 odoo
Posted
技术标签:
【中文标题】无法在 Mac OS X 中正确运行 odoo【英文标题】:Unable to run odoo properly in Mac OS X 【发布时间】:2016-05-09 10:41:49 【问题描述】:我已经在我的 Mac OS X El Capitan 10.11.2 中从 Git 安装了 Odoo 9 Community 版本,我的所有步骤:
python --version
Python 2.7.10
git clone https://github.com/odoo/odoo.git
Checking out files: 100% (20501/20501), done.
将PostgresApp安装到Applications
并在~/.bash_profile
中添加路径,执行相同。
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
安装的点子
sudo easy_install pip
Finished processing dependencies for pip
我的系统中安装了nodejs
,
node -v
v5.0.0
npm -v
3.3.9
已安装 less
和 less-plugin-clean-css
sudo npm install -g less less-plugin-clean-css
我安装了最新的 xcode,
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
我已经安装了自制软件,
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin Cellar CODEOFCONDUCT.md CONTRIBUTING.md etc include lib Library LICENSE.txt opt README.md sbin share SUPPORTERS.md var .git .gitignore
安装了其他库
brew install autoconf automake libtool
brew install libxml2 libxslt libevent
已安装的 Python 依赖项
sudo easy_install -U setuptools
Finished processing dependencies for setuptools
cd odoo/
sudo pip install --user -r requirements.txt
Successfully installed Mako-1.0.1 Pillow-2.7.0 Werkzeug-0.9.6 argparse-1.2.1 lxml-3.4.1 psutil-2.2.0 psycopg2-2.5.4 pyparsing-2.0.1 python-dateutil-1.5 python-ldap-2.4.19 pytz-2013.7 pyusb-1.0.0b2 qrcode-5.1 six-1.4.1
运行 odoo
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
./odoo.py --addons-path=addons --db-filter=mydb
上面写着
2016-02-10 16:51:42,351 3389 INFO ? openerp: OpenERP version 9.0c
2016-02-10 16:51:42,351 3389 INFO ? openerp: addons paths: ['/Users/anshad/Library/Application Support/Odoo/addons/9.0', u'/Users/anshad/odoo/addons', '/Users/anshad/odoo/openerp/addons']
2016-02-10 16:51:42,352 3389 INFO ? openerp: database: default@default:default
2016-02-10 16:51:42,444 3389 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
浏览器显示500 500 Internal Server Error
在终端中,
conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
启动 PostgresApp 来解决这个问题。
现在我得到了没有 CSS 的数据库设置窗口,如下面的屏幕截图所示。
使用密码admin
创建数据库mydbodoo
并导航到主页http://localhost:8069/web/
它显示了一个带有黑色标题和 odoo 徽标的空白页面,终端也出现了一些错误。
ImportError: No module named pyPdf
./odoo.py --addons-path=addons --db-filter=mydb
2016-02-10 17:02:12,220 3589 INFO ? openerp: OpenERP version 9.0c
2016-02-10 17:02:12,220 3589 INFO ? openerp: addons paths: ['/Users/anshad/Library/Application Support/Odoo/addons/9.0', u'/Users/anshad/odoo/addons', '/Users/anshad/odoo/openerp/addons']
2016-02-10 17:02:12,221 3589 INFO ? openerp: database: default@default:default
2016-02-10 17:02:12,314 3589 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2016-02-10 17:02:16,855 3589 INFO ? openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres
2016-02-10 17:02:16,888 3589 INFO ? werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:16] "GET /web/ HTTP/1.1" 500 -
2016-02-10 17:02:16,895 3589 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/Library/Python/2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/Users/anshad/odoo/openerp/service/server.py", line 245, in app
return self.app(e, s)
File "/Users/anshad/odoo/openerp/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/Users/anshad/odoo/openerp/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/Users/anshad/odoo/openerp/http.py", line 1487, in __call__
self.load_addons()
File "/Users/anshad/odoo/openerp/http.py", line 1508, in load_addons
m = __import__('openerp.addons.' + module)
File "/Users/anshad/odoo/openerp/modules/module.py", line 61, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/Users/anshad/odoo/addons/document/__init__.py", line 4, in <module>
import models
File "/Users/anshad/odoo/addons/document/models/__init__.py", line 4, in <module>
import ir_attachment
File "/Users/anshad/odoo/addons/document/models/ir_attachment.py", line 8, in <module>
import pyPdf
ImportError: No module named pyPdf
2016-02-10 17:02:17,708 3589 INFO mydbodoo openerp.modules.loading: loading 1 modules...
2016-02-10 17:02:17,716 3589 INFO mydbodoo openerp.modules.loading: 1 modules loaded in 0.01s, 0 queries
2016-02-10 17:02:17,719 3589 INFO mydbodoo openerp.modules.loading: loading 4 modules...
2016-02-10 17:02:17,727 3589 INFO mydbodoo openerp.modules.loading: 4 modules loaded in 0.01s, 0 queries
2016-02-10 17:02:17,899 3589 INFO mydbodoo openerp.modules.loading: Modules loaded.
2016-02-10 17:02:17,900 3589 INFO mydbodoo openerp.addons.base.ir.ir_http: Generating routing map
2016-02-10 17:02:18,249 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/ HTTP/1.1" 200 -
2016-02-10 17:02:18,308 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/content/341-42af255/web.assets_common.0.css HTTP/1.1" 304 -
2016-02-10 17:02:18,350 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/static/src/css/full.css HTTP/1.1" 404 -
2016-02-10 17:02:18,367 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/content/343-4d5beef/web.assets_backend.0.css HTTP/1.1" 304 -
2016-02-10 17:02:18,411 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/content/344-4d5beef/web.assets_backend.js HTTP/1.1" 304 -
2016-02-10 17:02:18,428 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/content/342-42af255/web.assets_common.js HTTP/1.1" 304 -
2016-02-10 17:02:18,663 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/binary/company_logo HTTP/1.1" 304 -
2016-02-10 17:02:18,838 3589 INFO mydbodoo openerp.service.common: successful login from 'admin' using database 'mydbodoo'
2016-02-10 17:02:18,859 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "POST /web/session/get_session_info HTTP/1.1" 200 -
2016-02-10 17:02:18,893 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "POST /web/proxy/load HTTP/1.1" 200 -
2016-02-10 17:02:18,915 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "POST /web/session/modules HTTP/1.1" 200 -
2016-02-10 17:02:18,945 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "POST /web/dataset/search_read HTTP/1.1" 200 -
2016-02-10 17:02:18,945 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "POST /web/webclient/translations HTTP/1.1" 200 -
2016-02-10 17:02:18,991 3589 INFO mydbodoo werkzeug: 127.0.0.1 - - [10/Feb/2016 17:02:18] "GET /web/webclient/locale/en_US HTTP/1.1" 500 -
2016-02-10 17:02:18,998 3589 ERROR mydbodoo werkzeug: Error on request:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/Library/Python/2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/Users/anshad/odoo/openerp/service/server.py", line 245, in app
return self.app(e, s)
File "/Users/anshad/odoo/openerp/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/Users/anshad/odoo/openerp/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/Users/anshad/odoo/openerp/http.py", line 1488, in __call__
return self.dispatch(environ, start_response)
File "/Users/anshad/odoo/openerp/http.py", line 1652, in dispatch
result = ir_http._dispatch()
File "/Users/anshad/odoo/openerp/addons/base/ir/ir_http.py", line 186, in _dispatch
return self._handle_exception(e)
File "/Users/anshad/odoo/openerp/addons/base/ir/ir_http.py", line 157, in _handle_exception
return request._handle_exception(exception)
File "/Users/anshad/odoo/openerp/http.py", line 781, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/Users/anshad/odoo/openerp/addons/base/ir/ir_http.py", line 182, in _dispatch
result = request.dispatch()
File "/Users/anshad/odoo/openerp/http.py", line 840, in dispatch
r = self._call_function(**self.params)
File "/Users/anshad/odoo/openerp/http.py", line 316, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/Users/anshad/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/Users/anshad/odoo/openerp/http.py", line 309, in checked_call
result = self.endpoint(*a, **kw)
File "/Users/anshad/odoo/openerp/http.py", line 959, in __call__
return self.method(*args, **kw)
File "/Users/anshad/odoo/openerp/http.py", line 509, in response_wrap
response = f(*args, **kw)
File "/Users/anshad/odoo/addons/web/controllers/main.py", line 505, in load_locale
addons_path = http.addons_manifest['web']['addons_path']
KeyError: 'web'
屏幕截图:终端和文件系统
屏幕截图:数据库选择窗口
屏幕截图:主窗口
试过sudo pip install pyPdf
,它说Requirement already satisfied (use --upgrade to upgrade): pyPdf in /Users/anshad/Library/Python/2.7/lib/python/site-packages
【问题讨论】:
@anshad,当您全新安装并在浏览器中打开时,您将获得一个数据库页面,您需要在此处提供数据库名称、用户名和密码。这将是您的默认电子邮件/用户名和密码。 我认为你做对了,因为你得到了登录屏幕,去管理数据库并创建新的数据库,UN 和 pwd。在登录页面中使用那个 UN 和 PWD 可能是安装 bootstrap 或更少的问题。默认登录名和密码为“admin”和“admin”。 @Odedra 如何解决库安装问题以加载 CSS?我没有收到任何错误。 在 github 上获得了 odoo 的新来源并尝试 【参考方案1】:我遇到了同样的问题,而且我的系统似乎没有使用正确的六库。 您首先可以做的是更新您的库
sudo pip2 install six -U
一旦你这样做了,你的系统可能会再次使用错误的库。要检查这一点,您可以像这样创建一个 python 文件
#vi testsix.py to create the file
#type i to insert
import six
print six.__file__
#escape
#type wq to save
#chmod +x testsix.py
#python testsix.py
如果你读了
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.pyc
那么你必须删除这个文件
rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.*
然后你可以重新检查文件testsix.py并检查你得到这个路径
/Library/Python/2.7/site-packages/six.pyc
那么你应该重新启动你的 odoo 服务器。
我从Oriol Nieto's answer 得到这个,我试图解决我之前得到的内部服务器错误。
请注意,如果您使用的是 El Capitan,并且即使使用 sudo 也遇到了一些权限问题,您可能需要检查此link to remove some root access
【讨论】:
【参考方案2】:我做了所有事情,但无法在我的 mac 10.11.6 上运行 odoo。
我在尝试运行 odoo ./odoo.py
时遇到了这个问题
psycopg2 can't find symbol _PQbackendPID
我发现我安装了许多版本的 python,从 2.3 到 3.5
删除所有版本的pythonHow to uninstall Python 2.7 on a Mac OS X 10.6.4?
$ brew uninstall --force python3
$ brew uninstall --force python
清除~/.bash_profile
中的所有更改
还删除了/usr/local/lib/python2.7/site-packages
然后从头开始:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew install python
$ brew install postgresql
要立即启动 PostgreSQL,并在系统启动时自动启动,我们运行:
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
// I had error: LaunchAgents not found
// If you have error you can download postgres from postgresapp.com to manually start the server
安装一些依赖项
$ brew install freetype jpeg libpng libtiff webp xz
$ pip install --upgrade pip
$ pip uninstall virtualenv
$ pip install virtualenv
// Delete existing ~/odoo-env folder first
$ virtualenv ~/odoo-env
$ . ~/odoo-env/bin/activate
克隆git repository分支9.0
$ git clone https://github.com/odoo/odoo.git -b 9.0
切换到克隆的 odoo 目录(带有cd
)并运行(你必须在你的虚拟环境中):
$ pip install -r requirements.txt
如果安装成功,运行
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ python ./odoo.py
Christoph Giesel的精彩教程
【讨论】:
【参考方案3】:我刚刚在两个系统上进行了设置,一个是 Mac OS X El Capitan 10.11.2,另一个是我的主操作系统 - Ubuntu 15.04(事情变得容易多了,但也许只是因为我在每天)。
以下是两个系统的安装步骤。确保每个命令都成功完成(至少不报告任何错误)。
Mac OS X El Capitan 10.11.2
先决条件:我已经拥有git
和python 2.7.10
。
1) 克隆 odoo 存储库:
git clone https://github.com/odoo/odoo.git
2) 下载安装Postgresapp
现在添加到~/.bash_profile
:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
如果你已经打开了终端,只需执行上面的命令。
3) 安装pip
sudo easy_install pip
4) 安装nodejs
node
和npm
命令是否可用
5) 安装less
和less-plugin-clean-css
sudo npm install -g less less-plugin-clean-css
应该像这样显示输出:
/usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
less-plugin-clean-css@1.5.1 /usr/local/lib/node_modules/less-plugin-clean-css
└── clean-css@3.4.9 (source-map@0.4.4, commander@2.8.1)
less@2.6.0 /usr/local/lib/node_modules/less
├── mime@1.3.4
├── graceful-fs@3.0.8
├── image-size@0.3.5
├── errno@0.1.4 (prr@0.0.0)
├── promise@6.1.0 (asap@1.0.0)
├── source-map@0.4.4 (amdefine@1.0.0)
├── mkdirp@0.5.1 (minimist@0.0.8)
└── request@2.69.0 (aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.2, oauth-sign@0.8.1, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.1, node-uuid@1.4.7, qs@6.0.2, combined-stream@1.0.5, mime-types@2.1.9, form-data@1.0.0-rc3, aws4@1.2.1, hawk@3.1.3, bl@1.0.2, har-validator@2.0.6, http-signature@1.1.1)
6) 安装二进制依赖项
我认为并非以下所有步骤都是真正必要的,但我执行了它们,因此仅在实际需要它们的情况下包含它们。
在终端xcode-select --install
运行,出现对话框时-同意安装
转到http://brew.sh 并按照说明安装自制软件
拥有brew
后,在终端中运行以下命令:
brew install autoconf automake libtool
brew install libxml2 libxslt libevent
7) 安装 python 依赖项
sudo easy_install -U setuptools
pip install --user -r requirements.txt
它应该在最后显示如下内容:
Successfully installed Babel-1.3 Jinja2-2.7.3 Mako-1.0.1 MarkupSafe-0.23 Pillow-2.7.0 PyYAML-3.11 Python-Chart-1.39 Werkzeug-0.9.6 argparse-1.2.1 beautifulsoup4-4.4.1 decorator-3.4.0 docutils-0.12 feedparser-5.1.3 gdata-2.0.18 gevent-1.0.2 greenlet-0.4.7 jcconv-0.2.3 lxml-3.4.1 mock-1.0.1 ofxparse-0.14 passlib-1.6.2 psutil-2.2.0 psycogreen-1.0 psycopg2-2.5.4 pyPdf-1.13 pydot-1.0.2 pyparsing-2.0.1 pyserial-2.7 python-dateutil-1.5 python-ldap-2.4.19 python-openid-2.2.5 python-stdnum-1.2 pytz-2013.7 pyusb-1.0.0b2 qrcode-5.1 reportlab-3.1.44 requests-2.6.0 six-1.4.1 suds-jurko-0.6 vatnumber-1.2 vobject-0.6.6 xlwt-0.7.5
8) 运行odoo
cd odoo # change dir to the folder you cloned odoo to
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Re-check parameters, it looks like addons path you used is incorrect
./odoo.py --addons-path=addons --db-filter=mydb
现在您应该会看到如下输出:
INFO ? openerp: OpenERP version 9.0c
INFO ? openerp: addons paths: ['/Users/dev/Library/Application Support/Odoo/addons/9.0', u'/Users/dev/projects/odoo/addons', '/Users/dev/projects/odoo/openerp/addons']
INFO ? openerp: database: default@default:default
INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
9) 在浏览器中打开odoo
mydbodoo
(我认为前缀mydb
在这里很重要)和密码admin
您还可以选中复选框以加载演示数据
点击Create database
等一下,你应该会被重定向到odoo
界面(见第二张截图)
完成!
更新:带有 virtualenv 的 Mac OS X El Capitan 10.11.2
与上述相同,在步骤 (7)
上不要运行 pip install --user -r requirements.txt
而是这样:
pip install virtualenv # not sure here, sudo may be needed
mkdir ~/venv
cd ~/venv
mkdir odoo
virtualenv odoo
source ~/venv/odoo/bin/activate
cd ~/path/to/odoo
pip install -r requirements.txt # no sudo here!
现在继续步骤(8)
。每次启动 odoo 之前,请确保先激活 virtualenv:
source ~/venv/odoo/bin/activate
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
./odoo.py --addons-path=addons --db-filter=mydb
Ubuntu 15.04
先决条件:我已经有 postgresql 9.4.5、nodejs 0.10.25 和 python 2.7.8。
安装:
git clone https://github.com/odoo/odoo.git
cd odoo
sudo apt-get install libldap2-dev libsasl2-dev libevent-dev libxslt1-dev libxml2-dev
pip install -r requirements.txt
sudo npm install -g less less-plugin-clean-css
./odoo.py --addons-path=addons --db-filter=mydb
就是这样,现在设置方法与 Mac OS 的步骤 (9) 相同。
【讨论】:
我做了同样的更新问题。错误看起来像ImportError: No module named pyPdf
,仍然无法正常工作。
@devo 则表示 pip 安装不成功,pypdf
实际上是requirements.txt
中列出的要求之一。尝试重复步骤编号 (7) 并确保没有错误或是否有错误 - 然后发布它们,仅从导入错误中无法说出出了什么问题。我的猜测是 pip 在 pypdf 安装之前或期间失败。
我得到了问题中提到的成功响应。sudo pip install pyPdf
说Requirement already satisfied (use --upgrade to upgrade): pyPdf in /Users/anshad/Library/Python/2.7/lib/python/site-packages
@devo 看起来对 python 文件夹的访问权限有问题。 --user
标志应该安装到您的用户可以访问的位置,因此应该不需要 sudo
。解决此问题的另一种方法 - 安装 virtualenv,为 odoo 创建一个虚拟环境并在那里安装所有 python 依赖项(然后从该环境运行 odoo)。
@devo 我更新了答案,请参阅Update: Mac OS X El Capitan 10.11.2 with virtualenv
,它应该有助于解决依赖性。【参考方案4】:
它们可能是一些 python 模块、库、包或 nodejs 的问题。
尝试以下信息:
以下命令将安装 Odoo 所需的所有 python 模块。
pip install lxml
检查您的 werkzeug 版本。如果不是升级它,它将是 0.9.6,。
pip show werkzeug #this command will show the details of werkzeug
pip install werkzeug==0.9.6 #this command will install werkzeug up to 0.9.6
通过您首选的包管理器(homebrew、macports)安装 nodejs,然后安装 less 和 less-plugin-clean-css:
npm install -g less
npm install -g less-plugin-clean-css
欲了解更多信息,Odoo9 setup documentation.
注意:
默认登录名和密码将是 admin 和 admin。
编辑:1
尝试使用以下命令解决 ImportError: No module named pyPdf。
pip install pypdf
编辑:2
如果您没有找到相关分发者,请尝试以下命令。
pip install --allow-unverified pyPdf pyPdf
【讨论】:
我做了所有这些,仍然没有工作。更新的问题。 @devo,我已经编辑了我的答案,它将解决您的 ImportError 上面写着Could not find a version that satisfies the requirement python-pypdf (from versions: ) No matching distribution found for python-pypdf
说Requirement already satisfied (use --upgrade to upgrade): pyPdf in /Users/anshad/Library/Python/2.7/lib/python/site-packages
以上是关于无法在 Mac OS X 中正确运行 odoo的主要内容,如果未能解决你的问题,请参考以下文章
Mac OS X sudo docker 无法连接到 Docker 守护程序。 docker 守护进程是不是在此主机上运行?
无法使用 pacifist 在带有 Java 1.7.0.45 的 Mac OS X 10.6.8 上运行线程化的 java jar 文件