当我尝试在virtualenv中安装mongoengine时,我遇到了问题:
Requirement already satisfied (use --upgrade to upgrade): flask-mongoengine in ./lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.8 in ./lib/python2.7/site-packages (from flask-mongoengine)
Downloading/unpacking mongoengine>=0.7.10 (from flask-mongoengine)
Running setup.py (path:/var/www/msgapp/backend/build/mongoengine/setup.py) egg_info for package mongoengine
0.8.7
no previously-included directories found matching 'docs/_build'
Downloading/unpacking flask-wtf (from flask-mongoengine)
Running setup.py (path:/var/www/msgapp/backend/build/flask-wtf/setup.py) egg_info for package flask-wtf
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in ./lib/python2.7/site-packages (from Flask>=0.8->flask-mongoengine)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in ./lib/python2.7/site-packages (from Flask>=0.8->flask-mongoengine)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in ./lib/python2.7/site-packages (from Flask>=0.8->flask-mongoengine)
Requirement already satisfied (use --upgrade to upgrade): pymongo>=2.5 in ./lib/python2.7/site-packages (from mongoengine>=0.7.10->flask-mongoengine)
Requirement already satisfied (use --upgrade to upgrade): WTForms>=1.0.5,<2.0 in ./lib/python2.7/site-packages (from flask-wtf->flask-mongoengine)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in ./lib/python2.7/site-packages (from Jinja2>=2.4->Flask>=0.8->flask-mongoengine)
Installing collected packages: mongoengine, flask-wtf
Running setup.py install for mongoengine
0.8.7
no previously-included directories found matching 'docs/_build'
error: could not delete '/var/www/msgapp/backend/lib/python2.7/site-packages/bson/json_util.py': Permission denied
Complete output from command /var/www/msgapp/backend/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/www/msgapp/backend/build/mongoengine/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-811vit-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/msgapp/backend/include/site/python2.7:
0.8.7
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/common.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/document.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/context_managers.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/__init__.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/connection.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/errors.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/dereference.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/python_support.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/signals.py -> build/lib.linux-x86_64-2.7/mongoengine
copying mongoengine/fields.py -> build/lib.linux-x86_64-2.7/mongoengine
creating build/lib.linux-x86_64-2.7/bson
copying bson/json_util.py -> build/lib.linux-x86_64-2.7/bson
copying bson/objectid.py -> build/lib.linux-x86_64-2.7/bson
copying bson/py3compat.py -> build/lib.linux-x86_64-2.7/bson
copying bson/tz_util.py -> build/lib.linux-x86_64-2.7/bson
copying bson/max_key.py -> build/lib.linux-x86_64-2.7/bson
copying bson/binary.py -> build/lib.linux-x86_64-2.7/bson
copying bson/__init__.py -> build/lib.linux-x86_64-2.7/bson
copying bson/code.py -> build/lib.linux-x86_64-2.7/bson
copying bson/son.py -> build/lib.linux-x86_64-2.7/bson
copying bson/errors.py -> build/lib.linux-x86_64-2.7/bson
copying bson/timestamp.py -> build/lib.linux-x86_64-2.7/bson
copying bson/regex.py -> build/lib.linux-x86_64-2.7/bson
copying bson/dbref.py -> build/lib.linux-x86_64-2.7/bson
copying bson/min_key.py -> build/lib.linux-x86_64-2.7/bson
creating build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/metaclasses.py -> build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/common.py -> build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/document.py -> build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/__init__.py -> build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/datastructures.py -> build/lib.linux-x86_64-2.7/mongoengine/base
copying mongoengine/base/fields.py -> build/lib.linux-x86_64-2.7/mongoengine/base
creating build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/shortcuts.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/sessions.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/tests.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/storage.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/__init__.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/auth.py -> build/lib.linux-x86_64-2.7/mongoengine/django
copying mongoengine/django/utils.py -> build/lib.linux-x86_64-2.7/mongoengine/django
creating build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/queryset.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/base.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/visitor.py -> build/lib.linux-x86_64-2.7/mongoengine/querset
copying mongoengine/queryset/__init__.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/field_list.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/transform.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
copying mongoengine/queryset/manager.py -> build/lib.linux-x86_64-2.7/mongoengine/queryset
creating build/lib.linux-x86_64-2.7/mongoengine/django/mongo_auth
copying mongoengine/django/mongo_auth/__init__.py -> build/lib.linux-x86_64-2.7/mongoengine/django/mongo_auth
copying mongoengine/django/mongo_auth/models.py -> build/lib.linux-x86_64-2.7/mongoengine/django/mongo_auth
running egg_info
writing requirements to mongoengine.egg-info/requires.txt
writing mongoengine.egg-info/PKG-INFO
writing top-level names to mongoengine.egg-info/top_level.txt
writing dependency_links to mongoengine.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'mongoengine.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
writing manifest file 'mongoengine.egg-info/SOURCES.txt'
running install_lib
copying build/lib.linux-x86_64-2.7/mongoengine/base/metaclasses.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/base/common.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/base/document.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/base/__init__.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/base/datastructures.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/base/fields.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/base
copying build/lib.linux-x86_64-2.7/mongoengine/django/mongo_auth/__init__.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django/mongo_auth
copying build/lib.linux-x86_64-2.7/mongoengine/django/mongo_auth/models.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django/mongo_auth
copying build/lib.linux-x86_64-2.7/mongoengine/django/shortcuts.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/sessions.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/tests.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/storage.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/__init__.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/auth.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/django/utils.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/django
copying build/lib.linux-x86_64-2.7/mongoengine/common.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/document.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/queryset.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/base.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/visitor.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/__init__.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/field_list.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/transform.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/queryset/manager.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine/queryset
copying build/lib.linux-x86_64-2.7/mongoengine/context_managers.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/__init__.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/connection.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/errors.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/dereference.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/python_support.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/signals.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/mongoengine/fields.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/mongoengine
copying build/lib.linux-x86_64-2.7/bson/json_util.py -> /var/www/msgapp/backend/lib/python2.7/site-packages/bson
error: could not delete '/var/www/msgapp/backend/lib/python2.7/site-packages/bson/json_util.py': Permission denied
----------------------------------------
Cleaning up...
Command /var/www/msgapp/backend/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/www/msgapp/backend/build/mongoengine/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-811vit-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/msgapp/backend/include/site/python2.7 failed with error code 1 in /var/www/msgapp/backend/build/mongoengine
Storing debug log for failure in /home/www/.pip/pip.log
很高兴找到如何在virtualenv中安装它。
答案 0 :(得分:2)
错误消息显示安装程序尝试删除文件 /var/www/msgapp/backend/lib/python2.7/site-packages/bson/json_util.py ,但它失败了,因为您没有& #39; t有权限。
有两个可能的原因:
您正在尝试将mongoengine安装为拥有virtualenv的用户的其他用户。
我们假设您以用户holms
身份登录,因此您的bash提示符如下所示:
[holms @ localhost~] $
现在用以下方法检查virtualenv的所有权:
ls -la /var/www/msgapp/ | grep backend
如果输出应如下所示:
drwxr-XR-X。 9 holms holms 4096 05-06 15:49后端
如果不是 holms 而是获得 bruce ,那么virtualenv归该用户所有,您应该以 bruce 执行安装:
sudo su - bruce
source /var/www/msgapp/backend/bin/activate
pip install mongoengine
您以正确的用户身份登录但 /var/www/msgapp/backend/lib/python2.7/site-packages/bson/json_util.py 归某人所有其他。我再次假设你的用户名是 holms
检查权限:
ls -la /var/www/msgapp/backend/lib/python2.7/site-packages/bson/ | grep json_util.py
如果你看到其他人,例如 bruce 拥有此特定文件,然后更改ownerchip:
sudo chown holms:holms /var/www/msgapp/backend/lib/python2.7/site-packages/bson/
现在你应该可以安装mongoengine了。