3

在 python 中,当我运行时,import babel.dates我得到一个权限被拒绝:

Python 2.7.5+ (default, Jun  5 2013, 10:40:07) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel.dates
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/babel/__init__.py", line 33, in <module>
    from pkg_resources import get_distribution, ResolutionError
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
    callback(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2257, in activate
    self.insert_on(path)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2364, in insert_on
    self.check_version_conflict()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2403, in check_version_conflict
    for modname in self._get_metadata('top_level.txt'):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2251, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/python_dateutil-2.1-py2.7.egg/EGG-INFO/top_level.txt'
>>> 

操作系统:

shahar@shahar-desktop:~/openerp/source$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu Saucy Salamander (development branch)
Release:        13.10
Codename:       saucy

Python版本:

ii  libpython-stdlib:amd64                2.7.5-1ubuntu1                         amd64        interactive high-level object-oriented language (default python version)
ii  libpython2.7:amd64                    2.7.5-5ubuntu1                         amd64        Shared Python runtime library (version 2.7)
ii  libpython2.7-minimal:amd64            2.7.5-5ubuntu1                         amd64        Minimal subset of the Python language (version 2.7)
ii  libpython2.7-stdlib:amd64             2.7.5-5ubuntu1                         amd64        Interactive high-level object-oriented language (version 2.7)
ii  libpython3-stdlib:amd64               3.3.1-0ubuntu1                         amd64        interactive high-level object-oriented language (default python3 version)
ii  libpython3.3:amd64                    3.3.2-3ubuntu1                         amd64        Shared Python runtime library (version 3.3)
ii  libpython3.3-minimal:amd64            3.3.2-3ubuntu1                         amd64        Minimal subset of the Python language (version 3.3)
ii  libpython3.3-stdlib:amd64             3.3.2-3ubuntu1                         amd64        Interactive high-level object-oriented language (version 3.3)
ii  plasma-scriptengine-python            4:4.10.97-0ubuntu1                     all          Python script engine for Plasma
ii  python                                2.7.5-1ubuntu1                         amd64        interactive high-level object-oriented language (default version)
ii  python-antlr                          2.7.7+dfsg-5                           all          language tool for constructing recognizers, compilers etc
ii  python-apt                            0.8.8.2ubuntu1                         amd64        Python interface to libapt-pkg
ii  python-apt-common                     0.8.8.2ubuntu1                         all          Python interface to libapt-pkg (locales)
ii  python-babel                          0.9.6-1ubuntu1                         all          tools for internationalizing Python applications
ii  python-bzrlib                         2.6.0~bzr6574-1ubuntu1                 amd64        distributed version control system - python library
ii  python-cairo                          1.8.8-1ubuntu4                         amd64        Python bindings for the Cairo vector graphics library
ii  python-chardet                        2.0.1-2build1                          all          universal character encoding detector
ii  python-configobj                      4.7.2+ds-5                             all          simple but powerful config file reader and writer for Python
ii  python-crypto                         2.6-5                                  amd64        cryptographic algorithms and protocols for Python
ii  python-cups                           1.9.62-0ubuntu3                        amd64        Python bindings for CUPS
ii  python-cupshelpers                    1.3.12+20130308-0ubuntu4               all          Python modules for printer configuration with CUPS
ii  python-dateutil                       1.5+dfsg-0.1                           all          powerful extensions to the standard datetime module
ii  python-dbus                           1.2.0-2                                amd64        simple interprocess messaging system (Python interface)
ii  python-dbus-dev                       1.2.0-2                                all          main loop integration development files for python-dbus
ii  python-debian                         0.1.21+nmu2ubuntu1                     all          Python modules to work with Debian-related data formats
ii  python-egenix-mxdatetime              3.2.5-1                                amd64        date and time handling routines for Python
ii  python-egenix-mxtools                 3.2.5-1                                amd64        collection of additional builtins for Python
ii  python-feedparser                     5.1.2-1ubuntu2                         all          Universal Feed Parser for Python
ii  python-gdata                          2.0.18+dfsg-1                          all          Google Data Python client library
ii  python-gi                             3.9.2-0ubuntu2                         amd64        Python 2.x bindings for gobject-introspection libraries
ii  python-gi-cairo                       3.9.2-0ubuntu2                         amd64        Python Cairo bindings for the GObject library
ii  python-glade2                         2.24.0-3ubuntu1                        amd64        GTK+ bindings: Glade support
ii  python-gobject                        3.9.2-0ubuntu2                         all          Python 2.x bindings for GObject - transitional package
ii  python-gobject-2                      2.28.6-12                              amd64        deprecated static Python bindings for the GObject library
ii  python-gpgme                          0.3-0ubuntu1                           amd64        python wrapper for the GPGME library (Python 2)
ii  python-gtk2                           2.24.0-3ubuntu1                        amd64        Python bindings for the GTK+ widget set
ii  python-httplib2                       0.8-1                                  all          comprehensive HTTP client library written for Python
ii  python-imaging                        1.1.7+2.0.0-1ubuntu1                   amd64        Python Imaging Library (Pillow fork)
ii  python-imaging-compat                 1.1.7+2.0.0-1ubuntu1                   all          Python Imaging Library compatibility layer
ii  python-kde4                           4:4.10.95-0ubuntu1                     amd64        Python bindings for the KDE Development Platform
ii  python-keyring                        1.6-1                                  all          store and access your passwords safely
ii  python-launchpadlib                   1.10.2+ds-1                            all          Launchpad web services client library
ii  python-lazr.restfulclient             0.13.3-1                               all          client for lazr.restful-based web services
ii  python-lazr.uri                       1.0.3-1                                all          library for parsing, manipulating, and generating URIs
ii  python-ldap                           2.4.10-1                               amd64        LDAP interface module for Python
ii  python-libxml2                        2.9.1+dfsg1-2ubuntu1                   amd64        Python bindings for the GNOME XML library
ii  python-libxslt1                       1.1.28-1ubuntu1                        amd64        Python bindings for libxslt1
ii  python-lxml                           3.2.0-1                                amd64        pythonic binding for the libxml2 and libxslt libraries
ii  python-mako                           0.8.1-1                                all          fast and lightweight templating for the Python platform
ii  python-markupsafe                     0.15-1build3                           amd64        XML/HTML/XHTML Markup safe string for Python
ii  python-matplotlib                     1.2.1-0ubuntu1                         amd64        Python based plotting system in a style similar to Matlab
ii  python-matplotlib-data                1.2.1-0ubuntu1                         all          Python based plotting system (data package)
ii  python-minimal                        2.7.5-1ubuntu1                         amd64        minimal subset of the Python language (default version)
ii  python-newt                           0.52.15-2ubuntu1                       amd64        NEWT module for Python
ii  python-notify                         0.1.1-3ubuntu1                         amd64        Python bindings for libnotify
ii  python-numpy                          1:1.7.1-1ubuntu1                       amd64        Numerical Python adds a fast array facility to the Python language
ii  python-oauth                          1.0.1-3build1                          all          Python library implementing of the OAuth protocol
ii  python-openid                         2.2.5-3ubuntu1                         all          OpenID support for servers and consumers
ii  python-openssl                        0.13-2ubuntu3                          amd64        Python 2 wrapper around the OpenSSL library
ii  python-paramiko                       1.10.1-1                               all          Make ssh v2 connections with Python (Python 2)
ii  python-pexpect                        2.4-1                                  all          Python module for automating interactive applications
ii  python-pkg-resources                  0.6.37-1ubuntu1                        all          Package Discovery and Resource Access using pkg_resources
ii  python-psycopg2                       2.4.5-1build3                          amd64        Python module for PostgreSQL
ii  python-pybabel                        0.9.6-1ubuntu1                         all          tools for internationalizing Python applications (transitional dummy package)
ii  python-pychart                        1.39-7build1                           all          Python library for creating high quality charts
ii  python-reportlab                      2.6-1                                  all          ReportLab library to create PDF documents using Python
ii  python-reportlab-accel                2.6-1                                  amd64        C coded extension accelerator for the ReportLab Toolkit
ii  python-requests                       1.2.3-1                                all          elegant and simple HTTP library for Python, built for human beings
ii  python-scapy                          2.2.0-1                                all          Packet generator/sniffer and network scanner/discovery
ii  python-secretstorage                  1.0.0-1                                all          Python module for storing secrets - Python 2.x version
ii  python-setuptools                     0.6.37-1ubuntu1                        all          Python Distutils Enhancements (setuptools compatibility)
ii  python-simplejson                     3.3.0-2ubuntu2                         amd64        simple, fast, extensible JSON encoder/decoder for Python
ii  python-sip                            4.14.7-3ubuntu1                        amd64        Python/C++ bindings generator runtime library
ii  python-six                            1.3.0-1                                all          Python 2 and 3 compatibility library (Python 2 interface)
ii  python-sqlalchemy                     0.8.2-1                                all          SQL toolkit and Object Relational Mapper for Python
ii  python-sqlalchemy-ext                 0.8.2-1                                amd64        SQL toolkit and Object Relational Mapper for Python - C extension
ii  python-suds                           0.4.1-9                                all          Lightweight SOAP client for Python
ii  python-support                        1.0.15                                 all          automated rebuilding support for Python modules
ii  python-tk                             2.7.4-0ubuntu1                         amd64        Tkinter - Writing Tk applications with Python
ii  python-tz                             2012c-1                                all          Python version of the Olson timezone database
ii  python-uniconvertor                   1.1.4-1ubuntu2                         amd64        Universal vector graphics translator
ii  python-uno                            1:4.0.2-0ubuntu5                       amd64        Python-UNO bridge
ii  python-urllib3                        1.6-2                                  all          HTTP library with thread-safe connection pooling for Python
ii  python-utidylib                       0.2-8build1                            all          Python wrapper for TidyLib
ii  python-vatnumber                      1:1.0-4                                all          Python module to validate VAT numbers
ii  python-vobject                        0.8.1c-4ubuntu1                        all          parse iCalendar and VCards in Python
ii  python-vte                            1:0.28.2-5ubuntu1                      amd64        Python bindings for the VTE widget set
ii  python-wadllib                        1.3.2-2                                all          Python library for navigating WADL files
ii  python-webdav                         0.9.8-5                                all          WebDAV server implementation in Python
ii  python-werkzeug                       0.9.3+dfsg-1                           all          collection of utilities for WSGI applications
ii  python-xapian                         1.2.15-4                               amd64        Xapian search engine interface for Python
ii  python-xdg                            0.25-3                                 all          Python 2 library to access freedesktop.org standards
ii  python-xkit                           0.5.0ubuntu1                           all          library for the manipulation of xorg.conf files (Python 2)
ii  python-xlwt                           0.7.4+debian1-1                        all          module for writing Microsoft Excel spreadsheet files
ii  python-yaml                           3.10-4build2                           amd64        YAML parser and emitter for Python
ii  python-zope.interface                 4.0.5-1ubuntu2                         amd64        Interfaces for Python
ii  python2.7                             2.7.5-5ubuntu1                         amd64        Interactive high-level object-oriented language (version 2.7)
ii  python2.7-minimal                     2.7.5-5ubuntu1                         amd64        Minimal subset of the Python language (version 2.7)
ii  python3                               3.3.1-0ubuntu1                         amd64        interactive high-level object-oriented language (default python3 version)
ii  python3-apport                        2.11-0ubuntu1                          all          Python 3 library for Apport crash report handling
ii  python3-apt                           0.8.8.2ubuntu1                         amd64        Python 3 interface to libapt-pkg
ii  python3-aptdaemon                     1.0-0ubuntu10                          all          Python 3 module for the server and client of aptdaemon
ii  python3-aptdaemon.pkcompat            1.0-0ubuntu10                          all          PackageKit compatibilty for AptDaemon
ii  python3-chardet                       2.0.1-1                                all          universal encoding detector
ii  python3-commandnotfound               0.3ubuntu7                             all          Python 3 bindings for command-not-found.
ii  python3-dbus                          1.2.0-2                                amd64        simple interprocess messaging system (Python 3 interface)
ii  python3-dbus.mainloop.qt              4.10.2-1ubuntu1                        amd64        D-Bus Support for PyQt4 with Python 3
ii  python3-debian                        0.1.21+nmu2ubuntu1                     all          Python 3 modules to work with Debian-related data formats
ii  python3-defer                         1.0.6-2                                all          Small framework for asynchronous programming (Python 3)
ii  python3-distupgrade                   1:0.198                                all          manage release upgrades
ii  python3-gdbm:amd64                    3.3.1-0ubuntu2                         amd64        GNU dbm database support for Python 3.x
ii  python3-gi                            3.9.2-0ubuntu2                         amd64        Python 3 bindings for gobject-introspection libraries
ii  python3-minimal                       3.3.1-0ubuntu1                         amd64        minimal subset of the Python language (default python3 version)
ii  python3-pkg-resources                 0.6.37-1ubuntu1                        all          Package Discovery and Resource Access using pkg_resources
ii  python3-problem-report                2.11-0ubuntu1                          all          Python 3 library to handle problem reports
ii  python3-pykde4                        4:4.10.95-0ubuntu1                     amd64        Python 3 bindings for the KDE Development Platform
ii  python3-pyqt4                         4.10.2-1ubuntu1                        amd64        Python3 bindings for Qt4
ii  python3-sip                           4.14.7-3ubuntu1                        amd64        Python 3/C++ bindings generator runtime library
ii  python3-six                           1.3.0-1                                all          Python 2 and 3 compatibility library (Python 3 interface)
ii  python3-software-properties           0.92.24                                all          manage the repositories that you install software from
ii  python3-update-manager                1:0.190                                all          python 3.x module for update-manager
ii  python3-xkit                          0.5.0ubuntu1                           all          library for the manipulation of xorg.conf files (Python 3)
ii  python3.3                             3.3.2-3ubuntu1                         amd64        Interactive high-level object-oriented language (version 3.3)
ii  python3.3-minimal                     3.3.2-3ubuntu1                         amd64        Minimal subset of the Python language (version 3.3)
4

2 回答 2

1

当您键入make server时,脚本正在尝试读取只能由以下人员读取/写入的文件root

-rw------- 1 root staff 9 May 13 17:56 /usr/local/lib/python2.7/dist-packages/python_dateutil-2.1-py2.7.egg/EGG-INFO/top_level.txt

由于您以非 root 用户身份运行程序,因此权限被拒绝。

您可以运行sudo make server以 root 身份运行该命令。

于 2013-07-28T11:44:47.413 回答
1

好吧,在我看来,您可以通过以下方式更改权限:

sudo chmod 644 /usr/local/lib/python2.7/dist-packages/python_dateutil-2.1-py2.7.egg/EGG-INFO/top_level.txt
于 2014-04-11T01:35:38.873 回答