最近在研究Metrics在分布式程序中的打点统计,源码下载下来后有个doc文件夹,对其中文件进行编译时提示:
localhost:docs w3sun$ make Please use `make <target>' where <target> is one of html to make standalone HTML files dirhtml to make HTML files named index.html in directories singlehtml to make a single large HTML file pickle to make pickle files json to make JSON files htmlhelp to make HTML files and a HTML help project qthelp to make HTML files and a qthelp project devhelp to make HTML files and a Devhelp project epub to make an epub latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter latexpdf to make LaTeX files and run them through pdflatex text to make text files man to make manual pages texinfo to make Texinfo files info to make Texinfo files and run them through makeinfo gettext to make PO message catalogs changes to make an overview of all changed/added/deprecated items linkcheck to check all external links for integrity doctest to run all doctests embedded in the documentation (if enabled) localhost:docs neters$ make html lessc --compress source/_themes/metrics/less/metrics.less > source/_themes/metrics/static/metrics.css /bin/sh: lessc: command not found make: *** [less] Error 127
提示缺少lessc,为了能够获取完整的文档,需要根据以下步骤进行安装:
- 下载nodejs
https://nodejs.org/zh-cn/download/ 下载安装8.11.2版本即可。
- 验证安装是否成功
localhost:metrics neters$ node -v v8.11.2 localhost:metrics neters$ npm -v 5.6.0
- 安装lessc
localhost:docs w3sun$ npm install -g less npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /Users/w3sun/.npm/_logs/2018-06-12T16_02_27_231Z-debug.log
报错时需要切换sudo权限进行安装:
localhost:docs w3sun$ sudo npm install -g less Password: /usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc + less@3.0.4 added 57 packages in 18.038s localhost:docs neters$ lessc -v lessc 3.0.4 (Less Compiler) [JavaScript] #此时make html会报错,提示 ocalhost:docs neters$ make html lessc --compress source/_themes/metrics/less/metrics.less > source/_themes/metrics/static/metrics.css The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css. sphinx-build -b html -d target/doctrees source target/html make: sphinx-build: No such file or directory make: *** [html] Error 1
- 安装sphinx
localhost:docs w3sun$ pip install sphinx Collecting sphinx Could not fetch URL https://pypi.python.org/simple/sphinx/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping Could not find a version that satisfies the requirement sphinx (from versions: ) No matching distribution found for sphinx
直接安装会报错,需要升级pip:
localhost:docs w3sun$ curl https://bootstrap.pypa.io/get-pip.py | python % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1603k 100 1603k 0 0 1554k 0 0:00:01 0:00:01 --:--:-- 1555k Collecting pip Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 2.6MB/s Collecting wheel Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB) 100% |████████████████████████████████| 51kB 14.2MB/s Installing collected packages: pip, wheel Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 Successfully installed pip-10.0.1 wheel-0.31.1 localhost:docs neters$ pip install sphinx Collecting sphinx Downloading https://files.pythonhosted.org/packages/1b/9f/98d67201c5a6e1aececed03a44a819d0e32adba81414081e303cfaf8c54c/Sphinx-1.7.5-py2.py3-none-any.whl (1.9MB) 100% |████████████████████████████████| 1.9MB 2.1MB/s Collecting babel!=2.0,>=1.3 (from sphinx) Downloading https://files.pythonhosted.org/packages/b8/ad/c6f60602d3ee3d92fbed87675b6fb6a6f9a38c223343ababdb44ba201f10/Babel-2.6.0-py2.py3-none-any.whl (8.1MB) 100% |████████████████████████████████| 8.1MB 2.0MB/s Collecting requests>=2.0.0 (from sphinx) Downloading https://files.pythonhosted.org/packages/cc/15/e1c318dbc20032ffbe5628837ca0de2d5b116ffd1b849c699634010f6a5d/requests-2.19.0-py2.py3-none-any.whl (91kB) 100% |████████████████████████████████| 92kB 7.1MB/s Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from sphinx) (28.8.0) Collecting Jinja2>=2.3 (from sphinx) Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB) 100% |████████████████████████████████| 133kB 12.4MB/s Collecting typing; python_version < "3.5" (from sphinx) Downloading https://files.pythonhosted.org/packages/0d/4d/4e5985d075d241d686a1663fa1f88b61d544658d08c1375c7c6aac32afc3/typing-3.6.4-py2-none-any.whl Collecting imagesize (from sphinx) ....... Successfully built MarkupSafe Installing collected packages: pytz, babel, certifi, chardet, urllib3, idna, requests, MarkupSafe, Jinja2, typing, imagesize, six, Pygments, sphinxcontrib-websupport, pyparsing, packaging, alabaster, snowballstemmer, docutils, sphinx Successfully installed Jinja2-2.10 MarkupSafe-1.0 Pygments-2.2.0 alabaster-0.7.10 babel-2.6.0 certifi-2018.4.16 chardet-3.0.4 docutils-0.14 idna-2.7 imagesize-1.0.0 packaging-17.1 pyparsing-2.2.0 pytz-2018.4 requests-2.19.0 six-1.11.0 snowballstemmer-1.2.1 sphinx-1.7.5 sphinxcontrib-websupport-1.1.0 typing-3.6.4 urllib3-1.23
转载请注明:雪后西塘 » MacOS 安装lessc