mac解决pip安装模块权限问题

sudo pip install django-celery                                             1 ↵
The directory '/Users/Lcy/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Lcy/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting django-celery
  Downloading django-celery-3.1.17.tar.gz (79kB)
    100% |████████████████████████████████| 81kB 22kB/s
Requirement already satisfied: celery>=3.1.15 in /Library/Python/2.7/site-packages (from django-celery)
Requirement already satisfied: billiard<3.6.0,>=3.5.0.2 in /Library/Python/2.7/site-packages (from celery>=3.1.15->django-celery)
Requirement already satisfied: pytz>dev in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from celery>=3.1.15->django-celery)
Requirement already satisfied: kombu<5.0,>=4.0 in /Library/Python/2.7/site-packages (from celery>=3.1.15->django-celery)
Requirement already satisfied: amqp<3.0,>=2.1.1 in /Library/Python/2.7/site-packages (from kombu<5.0,>=4.0->celery>=3.1.15->django-celery)
Requirement already satisfied: vine>=1.1.3 in /Library/Python/2.7/site-packages (from amqp<3.0,>=2.1.1->kombu<5.0,>=4.0->celery>=3.1.15->django-celery)
Installing collected packages: django-celery
  Running setup.py install for django-celery ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-Qs3rVP/django-celery/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-PRVSFE-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/djcelery
    copying djcelery/__init__.py -> build/lib/djcelery
    copying djcelery/admin.py -> build/lib/djcelery
    copying djcelery/admin_utils.py -> build/lib/djcelery
    copying djcelery/app.py -> build/lib/djcelery
    copying djcelery/common.py -> build/lib/djcelery
    copying djcelery/compat.py -> build/lib/djcelery
    copying djcelery/db.py -> build/lib/djcelery
    copying djcelery/humanize.py -> build/lib/djcelery
    copying djcelery/loaders.py -> build/lib/djcelery
    copying djcelery/managers.py -> build/lib/djcelery
    copying djcelery/models.py -> build/lib/djcelery
    copying djcelery/mon.py -> build/lib/djcelery
    copying djcelery/picklefield.py -> build/lib/djcelery
    copying djcelery/schedulers.py -> build/lib/djcelery
    copying djcelery/snapshot.py -> build/lib/djcelery
    copying djcelery/urls.py -> build/lib/djcelery
    copying djcelery/utils.py -> build/lib/djcelery
    copying djcelery/views.py -> build/lib/djcelery
    creating build/lib/djcelery/backends
    copying djcelery/backends/__init__.py -> build/lib/djcelery/backends
    copying djcelery/backends/cache.py -> build/lib/djcelery/backends
    copying djcelery/backends/database.py -> build/lib/djcelery/backends
    creating build/lib/djcelery/contrib
    copying djcelery/contrib/__init__.py -> build/lib/djcelery/contrib
    copying djcelery/contrib/test_runner.py -> build/lib/djcelery/contrib
    creating build/lib/djcelery/management
    copying djcelery/management/__init__.py -> build/lib/djcelery/management
    copying djcelery/management/base.py -> build/lib/djcelery/management
    creating build/lib/djcelery/management/commands
    copying djcelery/management/commands/__init__.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celery.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celerybeat.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celerycam.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celeryd.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celeryd_detach.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celeryd_multi.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/celerymon.py -> build/lib/djcelery/management/commands
    copying djcelery/management/commands/djcelerymon.py -> build/lib/djcelery/management/commands
    creating build/lib/djcelery/migrations
    copying djcelery/migrations/0001_initial.py -> build/lib/djcelery/migrations
    copying djcelery/migrations/__init__.py -> build/lib/djcelery/migrations
    creating build/lib/djcelery/monproj
    copying djcelery/monproj/__init__.py -> build/lib/djcelery/monproj
    copying djcelery/monproj/urls.py -> build/lib/djcelery/monproj
    creating build/lib/djcelery/south_migrations
    copying djcelery/south_migrations/0001_initial.py -> build/lib/djcelery/south_migrations
    copying djcelery/south_migrations/0002_v25_changes.py -> build/lib/djcelery/south_migrations
    copying djcelery/south_migrations/0003_v26_changes.py -> build/lib/djcelery/south_migrations
    copying djcelery/south_migrations/0004_v30_changes.py -> build/lib/djcelery/south_migrations
    copying djcelery/south_migrations/__init__.py -> build/lib/djcelery/south_migrations
    creating build/lib/djcelery/tests
    copying djcelery/tests/__init__.py -> build/lib/djcelery/tests
    copying djcelery/tests/req.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_discovery.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_loaders.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_models.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_schedulers.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_snapshot.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_views.py -> build/lib/djcelery/tests
    copying djcelery/tests/test_worker_job.py -> build/lib/djcelery/tests
    copying djcelery/tests/utils.py -> build/lib/djcelery/tests
    creating build/lib/djcelery/tests/test_backends
    copying djcelery/tests/test_backends/__init__.py -> build/lib/djcelery/tests/test_backends
    copying djcelery/tests/test_backends/test_cache.py -> build/lib/djcelery/tests/test_backends
    copying djcelery/tests/test_backends/test_database.py -> build/lib/djcelery/tests/test_backends
    creating build/lib/djcelery/transport
    copying djcelery/transport/__init__.py -> build/lib/djcelery/transport
    running install_lib
    running install_data
    creating /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
    error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages': Operation not permitted

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-Qs3rVP/django-celery/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-PRVSFE-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-Qs3rVP/django-celery/

解决办法(基于用户的权限来安装模块包):

sudo pip install django-celery --user -U
文 / admin
LEAVE A REPLY

loading