您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页Python学习之安装第三方模块

Python学习之安装第三方模块

来源:二三四教育网

关于Mac下安装时 Python Imaging Library(Pillow) 报错 error: could not create '/Library/Python/2.7/site-packages/olefile': Permission denied的解决方法之一:

报错详情:(格式调整了一下,以便浏览)

$ pip install Pillow 
Collecting Pillow
  Downloading Pillow-4.2.1-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.5MB 8.7kB/s 
Collecting olefile (from Pillow)
  Downloading olefile-0.44.zip (74kB)
    100% |████████████████████████████████| 81kB 22kB/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/lf/
j4jbbcrn0ql_4d06_zl1y_wm0000gn/T/pip-build-Gcekmp/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/lf/j4jbbcrn0ql_4d06_zl1y_wm0000gn/
T/pip-v1VxKP-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/lf/j4jbbcrn0ql_4d06_zl1y_wm0000gn/
T/pip-build-Gcekmp/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/lf/j4jbbcrn0ql_4d06_zl1y_wm0000gn/
T/pip-v1VxKP-record/install-record.txt 
--single-version-externally-managed --compile" 
failed with error code 1 in /private/var/folders/
lf/j4jbbcrn0ql_4d06_zl1y_wm0000gn/T/pip-build-Gcekmp/olefile/


Try python setup.py install --user

You shouldn't use sudo as suggested above for two reasons:

You're allowing arbitrary untrusted code off the internet to 
be run as root
Passing the --user flag to python setup.py install will install 
the package to a user-owned directory. 
Your normal non-root user won't be able to
access the files installed by sudo pip or sudo python setup.py

比较赞, 于是:

$ pip install Pillow --user
Collecting Pillow
  Using cached Pillow-4.2.1-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 ... done
Successfully installed Pillow-4.2.1 olefile-0.44

解决问题。

本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。

热门图文

Copyright © 2019-2025 how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务