Sphinx Quickstart不会让我超过我们确认我们需要英文文档的步骤。
我有一个现有的CONDA venv,名为- demo_venv。我激活它并执行pip安装,目录结构如下所示-
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ pip install sphinx目录树-
pycon-sphinx-tutorial
├── crawler
├── install.sh
├── README.rst
├── tutorial从-树中可以看到,上面的错误和下面的错误是PermissionError: Errno 13。
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ sphinx-quickstart
Welcome to the Sphinx 2.2.1 quickstart utility.
Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).
Selected root path: .
You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: y
The project name will occur in several places in the built documentation.
> Project name: Crawler
> Author name(s): RohitDhankar
> Project release []: 1.0
If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.
For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]: en
Traceback (most recent call last):
File "/home/dhankar/anaconda2/envs/demo_venv/bin/sphinx-quickstart", line 10, in <module>
sys.exit(main())
File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/cmd/quickstart.py", line 615, in main
generate(d, overwrite=False, templatedir=args.templatedir)
File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/cmd/quickstart.py", line 371, in generate
ensuredir(srcdir)
File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/util/osutil.py", line 79, in ensuredir
os.makedirs(path, exist_ok=True)
File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: './source'我知道我需要更改我的根路径/根目录-到目前为止,SPHINX内部模块/文件- sphinx/cmd/quickstart.py无法到达它拥有创建_build目录的正确权限的正确路径。我的问题是--如何解决这个问题?
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ sphinx-quickstart -c /media/dhankar/Dhankar_1/a5_test_sphinx
usage: sphinx-quickstart [OPTIONS] <PROJECT_DIR>
sphinx-quickstart: error: unrecognized arguments: -c发布于 2019-10-30 00:35:13
我不确定这是不是最好的甚至是正确的方法。但现在我是这么做的-
sphinx/cmd/quickstart.py -如下所示,更改了字典默认值中path的值。DEFAULTS = {
#'path': '.',
'path': '/media/dhankar/Dhankar_1/a5_test_sphinx/',
'sep': False,
'dot': '_',
'language': None,
'suffix': '.rst',
'master': 'index',
'makefile': True,
'batchfile': True,
}这给了我在终点站-
Welcome to the Sphinx 2.2.1 quickstart utility.
Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).
Selected root path: .
You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: n
The project name will occur in several places in the built documentation.
> Project name: Crawler
> Author name(s): RohitDhankar
> Project release []: 1.0
If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.
For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]: en
Creating file ./conf.py.
Creating file ./index.rst.
Creating file ./Makefile.
Creating file ./make.bat.
Finished: An initial directory structure has been created.
You should now populate your master file ./index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.另外,目录中的树如下所示-
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ tree
.
└── pycon-sphinx-tutorial
├── crawler
│ ├── _build
│ ├── conf.py
│ ├── docs
│ ├── index.rst
│ ├── make.bat
│ ├── Makefile
│ ├── src
│ │ ├── crawler
│ │ │ ├── __init__.py
│ │ │ ├── main.py
│ │ │ └── utils.py
│ │ └── __init__.py
│ ├── _static
│ └── _templates
├── install.sh
├── README.rst
├── tutorial
│ ├── cheatsheet.html
│ ├── finish.html
│ ├── genindex.html
│ ├── glossary.html
│ ├── _images
│ │ ├── cheatsheet-back-full.png
│ │ └── cheatsheet-front-full.png
│ ├── index.html
│ ├── objects.inv
│ ├── py-modindex.html
│ ├── search.html
│ ├── searchindex.js
│ ├── _sources
│ │ ├── cheatsheet.txt
│ │ ├── finish.txt
│ │ ├── glossary.txt
│ │ ├── index.txt
│ │ ├── start.txt
│ │ ├── step-1.txt
│ │ ├── step-2.txt
│ │ ├── step-3.txt
│ │ └── useful-links.txt
│ ├── start.html
│ ├── _static
│ │ ├── ajax-loader.gif
│ │ ├── basic.css
│ │ ├── comment-bright.png
│ │ ├── comment-close.png
│ │ ├── comment.png
│ │ ├── css
│ │ │ ├── badge_only.css
│ │ │ ├── badge_only.css.map
│ │ │ ├── theme.css
│ │ │ └── theme.css.map
│ │ ├── doctools.js
│ │ ├── down.png
│ │ ├── down-pressed.png
│ │ ├── file.png
│ │ ├── fonts
│ │ │ ├── FontAwesome.otf
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.svg
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ ├── Inconsolata-Bold.ttf
│ │ │ ├── Inconsolata-Regular.ttf
│ │ │ ├── Inconsolata.ttf
│ │ │ ├── Lato-Bold.ttf
│ │ │ ├── Lato-Regular.ttf
│ │ │ ├── RobotoSlab-Bold.ttf
│ │ │ └── RobotoSlab-Regular.ttf
│ │ ├── jquery-1.11.1.js
│ │ ├── jquery.js
│ │ ├── js
│ │ │ ├── modernizr.min.js
│ │ │ └── theme.js
│ │ ├── minus.png
│ │ ├── plus.png
│ │ ├── pygments.css
│ │ ├── searchtools.js
│ │ ├── underscore-1.3.1.js
│ │ ├── underscore.js
│ │ ├── up.png
│ │ ├── up-pressed.png
│ │ └── websupport.js
│ ├── step-1.html
│ ├── step-2.html
│ ├── step-3.html
│ └── useful-links.html
└── tutorial-setup.sh
15 directories, 75 files
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ 还没有做任何其他事情-将报告,如果这工作。
编辑--1-
进一步手动修改目录结构-现在树如下所示-
└── pycon-sphinx-tutorial
├── crawler
│ ├── docs
│ │ ├── _build
│ │ ├── conf.py
│ │ ├── index.rst
│ │ ├── make.bat
│ │ ├── Makefile
│ │ ├── _static
│ │ └── _templates
│ └── src
│ ├── crawler
│ │ ├── __init__.py
│ │ ├── main.py
│ │ └── utils.py
│ └── __init__.py
├── install.sh
├── README.rst
├── tutorial
│ ├── cheatsheet.html
│ ├── finish.html
│ ├── genindex.html
│ ├── glossary.html
│ ├── _images
│ │ ├── cheatsheet-back-full.png
│ │ └── cheatsheet-front-full.png
│ ├── index.html
│ ├── objects.inv
│ ├── py-modindex.html
│ ├── search.html
│ ├── searchindex.js
│ ├── _sources
│ │ ├── cheatsheet.txt
│ │ ├── finish.txt
│ │ ├── glossary.txt
│ │ ├── index.txt
│ │ ├── start.txt
│ │ ├── step-1.txt
│ │ ├── step-2.txt
│ │ ├── step-3.txt
│ │ └── useful-links.txt
│ ├── start.html
│ ├── _static
│ │ ├── ajax-loader.gif
│ │ ├── basic.css
│ │ ├── comment-bright.png
│ │ ├── comment-close.png
│ │ ├── comment.png
│ │ ├── css
│ │ │ ├── badge_only.css
│ │ │ ├── badge_only.css.map
│ │ │ ├── theme.css
│ │ │ └── theme.css.map
│ │ ├── doctools.js
│ │ ├── down.png
│ │ ├── down-pressed.png
│ │ ├── file.png
│ │ ├── fonts
│ │ │ ├── FontAwesome.otf
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.svg
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ ├── Inconsolata-Bold.ttf
│ │ │ ├── Inconsolata-Regular.ttf
│ │ │ ├── Inconsolata.ttf
│ │ │ ├── Lato-Bold.ttf
│ │ │ ├── Lato-Regular.ttf
│ │ │ ├── RobotoSlab-Bold.ttf
│ │ │ └── RobotoSlab-Regular.ttf
│ │ ├── jquery-1.11.1.js
│ │ ├── jquery.js
│ │ ├── js
│ │ │ ├── modernizr.min.js
│ │ │ └── theme.js
│ │ ├── minus.png
│ │ ├── plus.png
│ │ ├── pygments.css
│ │ ├── searchtools.js
│ │ ├── underscore-1.3.1.js
│ │ ├── underscore.js
│ │ ├── up.png
│ │ ├── up-pressed.png
│ │ └── websupport.js
│ ├── step-1.html
│ ├── step-2.html
│ ├── step-3.html
│ └── useful-links.html
└── tutorial-setup.sh
15 directories, 75 files编辑-2
现在看起来一切都很好-我最初的问题仍然是--我该如何正确地更改路径- Selected root path: .,而不是缺省路径?
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ make html
Running Sphinx v2.2.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindexdone
writing additional pages... searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.
The HTML pages are in _build/html.我可以在http://localhost:8000/上提供基本页面
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ cd _build/
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build$ ls
doctrees html
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build$ cd html
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build/html$ ls
genindex.html index.html objects.inv search.html searchindex.js _sources _static
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build/html$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/alabaster.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/pygments.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/documentation_options.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/underscore.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/custom.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/doctools.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/language_data.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/basic.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:42] code 404, message File not found
127.0.0.1 - - [29/Oct/2019 22:31:42] "GET /favicon.ico HTTP/1.1" 404 -https://stackoverflow.com/questions/58611021
复制相似问题