V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
djgreat
V2EX  ›  程序员

Mac 下 pip install Pillow 错误

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

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