2017-02-20 122 views
0

我在安裝Pillow時遇到問題。 下面是完整回溯:安裝枕頭(Django)時出錯

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/ 

的錯誤似乎是「權限被拒絕」試圖創建的文件夾時,雖然我不明白爲什麼...

我的機器運行的是Mac OSX,而​​我正在使用終端來運行此Django項目的命令。

回答

1

因爲普通用戶沒有全局安裝軟件包的權限。或者使用sudo運行,或者 - 更好 - 使用virtualenv並在那裏安裝你的軟件包。