我通过终端下载了pip,然后在下载后输入了“pip install xlwt” 我收到以下错误消息...
Nishons-MacBook-Pro:~ nishon$ pip install xlwt
Collecting xlwt
Downloading xlwt-0.7.5.tar.gz (115kB)
100% |################################| 118kB 737kB/s
Installing collected packages: xlwt
Running setup.py install for xlwt
error: could not create '/Library/Python/2.7/site-packages/xlwt': Permission denied
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/x4/fr2l9c7d303146hw0j1hd16c0000gn/T/pip-build-e3QAt5/xlwt/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/x4/fr2l9c7d303146hw0j1hd16c0000gn/T/pip-vjmP8d-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/xlwt
copying xlwt/__init__.py -> build/lib/xlwt
copying xlwt/antlr.py -> build/lib/xlwt
copying xlwt/BIFFRecords.py -> build/lib/xlwt
copying xlwt/Bitmap.py -> build/lib/xlwt
copying xlwt/Cell.py -> build/lib/xlwt
copying xlwt/Column.py -> build/lib/xlwt
copying xlwt/CompoundDoc.py -> build/lib/xlwt
copying xlwt/ExcelFormula.py -> build/lib/xlwt
copying xlwt/ExcelFormulaLexer.py -> build/lib/xlwt
copying xlwt/ExcelFormulaParser.py -> build/lib/xlwt
copying xlwt/ExcelMagic.py -> build/lib/xlwt
copying xlwt/Formatting.py -> build/lib/xlwt
copying xlwt/Row.py -> build/lib/xlwt
copying xlwt/Style.py -> build/lib/xlwt
copying xlwt/UnicodeUtils.py -> build/lib/xlwt
copying xlwt/Utils.py -> build/lib/xlwt
copying xlwt/Workbook.py -> build/lib/xlwt
copying xlwt/Worksheet.py -> build/lib/xlwt
creating build/lib/xlwt/doc
copying xlwt/doc/xlwt.html -> build/lib/xlwt/doc
creating build/lib/xlwt/examples
copying xlwt/examples/big-16Mb.py -> build/lib/xlwt/examples
copying xlwt/examples/big-35Mb.py -> build/lib/xlwt/examples
copying xlwt/examples/blanks.py -> build/lib/xlwt/examples
copying xlwt/examples/col_width.py -> build/lib/xlwt/examples
copying xlwt/examples/country.py -> build/lib/xlwt/examples
copying xlwt/examples/dates.py -> build/lib/xlwt/examples
copying xlwt/examples/format.py -> build/lib/xlwt/examples
copying xlwt/examples/formula_names.py -> build/lib/xlwt/examples
copying xlwt/examples/formulas.py -> build/lib/xlwt/examples
copying xlwt/examples/hyperlinks.py -> build/lib/xlwt/examples
copying xlwt/examples/image.py -> build/lib/xlwt/examples
copying xlwt/examples/merged.py -> build/lib/xlwt/examples
copying xlwt/examples/merged0.py -> build/lib/xlwt/examples
copying xlwt/examples/merged1.py -> build/lib/xlwt/examples
copying xlwt/examples/mini.py -> build/lib/xlwt/examples
copying xlwt/examples/num_formats.py -> build/lib/xlwt/examples
copying xlwt/examples/outline.py -> build/lib/xlwt/examples
copying xlwt/examples/panes.py -> build/lib/xlwt/examples
copying xlwt/examples/parse-fmla.py -> build/lib/xlwt/examples
copying xlwt/examples/protection.py -> build/lib/xlwt/examples
copying xlwt/examples/python.bmp -> build/lib/xlwt/examples
copying xlwt/examples/row_styles.py -> build/lib/xlwt/examples
copying xlwt/examples/row_styles_empty.py -> build/lib/xlwt/examples
copying xlwt/examples/simple.py -> build/lib/xlwt/examples
copying xlwt/examples/sst.py -> build/lib/xlwt/examples
copying xlwt/examples/unicode0.py -> build/lib/xlwt/examples
copying xlwt/examples/unicode1.py -> build/lib/xlwt/examples
copying xlwt/examples/unicode2.py -> build/lib/xlwt/examples
copying xlwt/examples/wsprops.py -> build/lib/xlwt/examples
copying xlwt/examples/xlwt_easyxf_simple_demo.py -> build/lib/xlwt/examples
running install_lib
creating /Library/Python/2.7/site-packages/xlwt
error: could not create '/Library/Python/2.7/site-packages/xlwt': Permission denied
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/x4/fr2l9c7d303146hw0j1hd16c0000gn/T/pip-build-e3QAt5/xlwt/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/x4/fr2l9c7d303146hw0j1hd16c0000gn/T/pip-vjmP8d-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/x4/fr2l9c7d303146hw0j1hd16c0000gn/T/pip-build-e3QAt5/xlwt
Nishons-MacBook-Pro:~ nishon$
答案 0 :(得分:1)
在全局安装软件包时,您需要使用sudo
命令,因为您的用户没有/Library/Python/2.7/site-packages
的写入权限。尝试运行
sudo pip install xlwt
代替。