简体   繁体   English

安装枕头时出错(Django)

[英]Error installing Pillow (Django)

I'm having trouble getting Pillow to install. 我无法安装Pillow。 Here's the full traceback: 这是完整的追溯:

Collecting Pillow
  Using cached Pillow-4.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting olefile (from Pillow)
  Using cached olefile-0.44.zip
Installing collected packages: olefile, Pillow
  Running setup.py install for olefile ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-QHsEXV-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying OleFileIO_PL.py -> build/lib
    creating build/lib/olefile
    copying olefile/__init__.py -> build/lib/olefile
    copying olefile/olefile.py -> build/lib/olefile
    copying olefile/README.rst -> build/lib/olefile
    copying olefile/README.html -> build/lib/olefile
    copying olefile/LICENSE.txt -> build/lib/olefile
    copying olefile/CONTRIBUTORS.txt -> build/lib/olefile
    running install_lib
    creating /Library/Python/2.7/site-packages/olefile
    error: could not create '/Library/Python/2.7/site-packages/olefile': Permission denied

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-QHsEXV-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/

The error seems to be 'Permission denied' when attempting to create the folder; 尝试创建文件夹时,错误似乎是“权限被拒绝”。 though I cannot understand why... 虽然我不明白为什么...

My machine is running Mac OSX, and I'm using Terminal to run the commands for this Django project. 我的机器正在运行Mac OSX,并且我正在使用Terminal运行此Django项目的命令。

Because the normal user doesn't have permission to install packages globally. 因为普通用户无权全局安装软件包。 Either run with sudo , or - much better - use a virtualenv and install your packages in there. 使用sudo运行,或者-更好-使用virtualenv并在其中安装软件包。

There're several questions regarding this problem, I'd suggest to take a look at these: 关于这个问题有几个问题,我建议看一下这些问题:

I prefer the second one but it also depends on your project/app structure 我更喜欢第二个,但这也取决于您的项目/应用程序结构

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM