• 请不要在回答技术问题时复制粘贴 AI 生成的内容
djgreat
V2EX  ›  程序员

Mac 下 pip install Pillow 错误

  •  
  •   djgreat · Dec 6, 2017 · 5129 views
    This topic created in 3256 days ago, the information mentioned may be changed or developed.

    错误代码:

    djgreat$ pip install Pillow
    Collecting Pillow Downloading Pillow-4.3.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 (3.5MB) 100% |████████████████████████████████| 3.6MB 206kB/s Collecting olefile (from Pillow) Downloading olefile-0.44.zip (74kB) 100% |████████████████████████████████| 81kB 2.9MB/s 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/dn/qh6ggd61445867b_qnz9qszw0000gn/T/pip-build-cOMAKE/olefile/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/dn/qh6ggd61445867b_qnz9qszw0000gn/T/pip-WNLWb9-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/dn/qh6ggd61445867b_qnz9qszw0000gn/T/pip-build-cOMAKE/olefile/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/dn/qh6ggd61445867b_qnz9qszw0000gn/T/pip-WNLWb9-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dn/qh6ggd61445867b_qnz9qszw0000gn/T/pip-build-cOMAKE/olefile/

    20 replies  •  2017-12-07 06:09:42 +08:00
    likuku
    likuku
    Dec 6, 2017
    1
    强烈推荐使用 pyenv,不要去折腾系统自带的 python 环境。
    lzdhlsc
    lzdhlsc
    Dec 6, 2017❤️1
    2
    error message 上不是写了 create file permission denied 了? 难道不是这个问题吗?
    am241
    am241
    Dec 6, 2017 via Android
    3
    linux 下都是 sudo -H pip/pip3 install ...
    mac 没用过
    billgreen1
    billgreen1
    Dec 6, 2017
    4
    推荐使用 anaconda,它自带了很多常用的软件包,第二会把自身路径放到系统的 python 之前,这样你以后安装都会安装到 anaconda,不会“污染”系统
    leavic
    leavic
    Dec 6, 2017
    5
    第一天在 mac 上用 python 吗?正确姿势不是应该用 brew 装 python 吗,怎么还用系统自带的 python 和 pip。
    knktc
    knktc
    Dec 6, 2017 via Android
    6
    权限问题吧,加上 sudo 试试
    toono
    toono
    Dec 6, 2017
    7
    老话题了 搜搜就能有
    jsfaint
    jsfaint
    Dec 6, 2017
    8
    mac 上除非你 sudo,要不然你需要--user
    pip install --user Pillow
    mec
    mec
    Dec 6, 2017
    9
    用虚拟环境,Mac 的保护机制,没写权限
    Penton
    Penton
    Dec 6, 2017
    10
    加上 --user
    scriptB0y
    scriptB0y
    Dec 6, 2017
    11
    用虚拟环境,每个项目一个环境。https://virtualenvwrapper.readthedocs.io/en/latest/
    8355
    8355
    Dec 6, 2017
    12
    pip install --user 你值得拥有
    Kilerd
    Kilerd
    Dec 6, 2017
    13
    pyenv virtualenv 3.6 PROJECT_NAME

    pyenv activate PROJECT_NAME
    huangunic0rn
    huangunic0rn
    Dec 6, 2017 via Android
    14
    先 brew 安装 Python2,然后 pip2 install xxx...
    neosfung
    neosfung
    Dec 6, 2017
    15
    conda
    现在连 clang 都有了
    ivechan
    ivechan
    Dec 6, 2017
    16
    推荐 miniconda
    djgreat
    djgreat
    OP
    Dec 6, 2017
    17
    @billgreen1 下次使用这种方式。
    @leavic 确实真的第一次
    @knktc 就是这么解决的,3Q
    @huangunic0rn 安装了 brew 啦,谢谢
    解决方法,原来直接 pip install Pillow,没有权限,sudo pip install Pillow 即可。感谢大家!!已解决。
    ChangHaoWei
    ChangHaoWei
    Dec 6, 2017
    18
    首先推荐 brew, 然后推荐 pyenv,最后推荐 pyenv virtualenv
    hcnhcn012
    hcnhcn012
    Dec 6, 2017 via iPhone
    19
    这么明显的 permission denying
    sunwei0325
    sunwei0325
    Dec 7, 2017
    20
    隔离环境我推荐 pipenv 或者 virtualenvwrapper
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2814 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 12:30 · PVG 20:30 · LAX 04:30 · JFK 07:30
    ♥ Do have faith in what you're doing.