Mac 下 pip install Pillow 错误

2017-12-06 03:02:30 +08:00
 djgreat

错误代码:

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/

3812 次点击
所在节点    程序员
20 条回复
likuku
2017-12-06 03:07:07 +08:00
强烈推荐使用 pyenv,不要去折腾系统自带的 python 环境。
lzdhlsc
2017-12-06 05:09:54 +08:00
error message 上不是写了 create file permission denied 了? 难道不是这个问题吗?
am241
2017-12-06 06:10:22 +08:00
linux 下都是 sudo -H pip/pip3 install ...
mac 没用过
billgreen1
2017-12-06 07:03:13 +08:00
推荐使用 anaconda,它自带了很多常用的软件包,第二会把自身路径放到系统的 python 之前,这样你以后安装都会安装到 anaconda,不会“污染”系统
leavic
2017-12-06 08:08:52 +08:00
第一天在 mac 上用 python 吗?正确姿势不是应该用 brew 装 python 吗,怎么还用系统自带的 python 和 pip。
knktc
2017-12-06 08:26:41 +08:00
权限问题吧,加上 sudo 试试
toono
2017-12-06 08:34:11 +08:00
老话题了 搜搜就能有
jsfaint
2017-12-06 08:54:38 +08:00
mac 上除非你 sudo,要不然你需要--user
pip install --user Pillow
mec
2017-12-06 09:41:14 +08:00
用虚拟环境,Mac 的保护机制,没写权限
Penton
2017-12-06 09:53:04 +08:00
加上 --user
scriptB0y
2017-12-06 09:58:19 +08:00
用虚拟环境,每个项目一个环境。https://virtualenvwrapper.readthedocs.io/en/latest/
8355
2017-12-06 10:00:43 +08:00
pip install --user 你值得拥有
Kilerd
2017-12-06 10:01:38 +08:00
pyenv virtualenv 3.6 PROJECT_NAME

pyenv activate PROJECT_NAME
huangunic0rn
2017-12-06 10:02:20 +08:00
先 brew 安装 Python2,然后 pip2 install xxx...
neosfung
2017-12-06 10:02:45 +08:00
conda
现在连 clang 都有了
ivechan
2017-12-06 10:42:31 +08:00
推荐 miniconda
djgreat
2017-12-06 11:27:20 +08:00
@billgreen1 下次使用这种方式。
@leavic 确实真的第一次
@knktc 就是这么解决的,3Q
@huangunic0rn 安装了 brew 啦,谢谢
解决方法,原来直接 pip install Pillow,没有权限,sudo pip install Pillow 即可。感谢大家!!已解决。
ChangHaoWei
2017-12-06 14:12:25 +08:00
首先推荐 brew, 然后推荐 pyenv,最后推荐 pyenv virtualenv
hcnhcn012
2017-12-06 18:56:30 +08:00
这么明显的 permission denying
sunwei0325
2017-12-07 06:09:42 +08:00
隔离环境我推荐 pipenv 或者 virtualenvwrapper

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/412337

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX