错误代码:
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/
1
likuku 2017-12-06 03:07:07 +08:00
强烈推荐使用 pyenv,不要去折腾系统自带的 python 环境。
|
2
lzdhlsc 2017-12-06 05:09:54 +08:00 1
error message 上不是写了 create file permission denied 了? 难道不是这个问题吗?
|
3
am241 2017-12-06 06:10:22 +08:00 via Android
linux 下都是 sudo -H pip/pip3 install ...
mac 没用过 |
4
billgreen1 2017-12-06 07:03:13 +08:00
推荐使用 anaconda,它自带了很多常用的软件包,第二会把自身路径放到系统的 python 之前,这样你以后安装都会安装到 anaconda,不会“污染”系统
|
5
leavic 2017-12-06 08:08:52 +08:00
第一天在 mac 上用 python 吗?正确姿势不是应该用 brew 装 python 吗,怎么还用系统自带的 python 和 pip。
|
6
knktc 2017-12-06 08:26:41 +08:00 via Android
权限问题吧,加上 sudo 试试
|
7
toono 2017-12-06 08:34:11 +08:00
老话题了 搜搜就能有
|
8
jsfaint 2017-12-06 08:54:38 +08:00
mac 上除非你 sudo,要不然你需要--user
pip install --user Pillow |
9
mec 2017-12-06 09:41:14 +08:00
用虚拟环境,Mac 的保护机制,没写权限
|
10
Penton 2017-12-06 09:53:04 +08:00
加上 --user
|
11
scriptB0y 2017-12-06 09:58:19 +08:00
用虚拟环境,每个项目一个环境。https://virtualenvwrapper.readthedocs.io/en/latest/
|
12
8355 2017-12-06 10:00:43 +08:00
pip install --user 你值得拥有
|
13
Kilerd 2017-12-06 10:01:38 +08:00
pyenv virtualenv 3.6 PROJECT_NAME
pyenv activate PROJECT_NAME |
14
huangunic0rn 2017-12-06 10:02:20 +08:00 via Android
先 brew 安装 Python2,然后 pip2 install xxx...
|
15
neosfung 2017-12-06 10:02:45 +08:00
conda
现在连 clang 都有了 |
16
ivechan 2017-12-06 10:42:31 +08:00
推荐 miniconda
|
17
djgreat OP @billgreen1 下次使用这种方式。
@leavic 确实真的第一次 @knktc 就是这么解决的,3Q @huangunic0rn 安装了 brew 啦,谢谢 解决方法,原来直接 pip install Pillow,没有权限,sudo pip install Pillow 即可。感谢大家!!已解决。 |
18
ChangHaoWei 2017-12-06 14:12:25 +08:00
首先推荐 brew, 然后推荐 pyenv,最后推荐 pyenv virtualenv
|
19
hcnhcn012 2017-12-06 18:56:30 +08:00 via iPhone
这么明显的 permission denying
|
20
sunwei0325 2017-12-07 06:09:42 +08:00
隔离环境我推荐 pipenv 或者 virtualenvwrapper
|