gpt4 book ai didi

python - Sphinx在make html之后找不到我的任何模块

转载 作者:太空宇宙 更新时间:2023-11-03 19:44:17 24 4
gpt4 key购买 nike

当我尝试使用Sphinx生成文档时,生成的html为空,因为sphinx找不到我的模块。
这是我的存储库的树:

├── docs
│ ├── _build
│ ├── common.rst
│ ├── conf.py
│ ├── imputation.rst
│ ├── index.rst
│ ├── main.rst
│ ├── make.bat
│ ├── Makefile
│ ├── modules.rst
│ ├── preprocessing.rst
│ ├── _static
│ └── _templates
├── LICENSE
├── README.md
├── RecommendationEngine
│ ├── common.py
│ ├── **datos**
│ │ ├── tmdb_5000_credits.csv
│ │ └── tmdb_5000_movies.csv
│ ├── **imputation.py**
│ ├── **main.py**
│ ├── **preprocessing.py**
│ └── __pycache__
│ ├── common.cpython-36.pyc
│ ├── imputation.cpython-36.pyc
│ ├── main.cpython-36.pyc
│ └── preprocessing.cpython-36.pyc
└── setup.py


我的路径的Sphinx配置是这样制作的:

import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))


在大多数类似问题的答案中,这可以解决问题。但是,当我执行 make html时,将返回:

make html
Running Sphinx v2.4.1
loading translations [es]... done
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 5 changed, 0 removed
reading sources... [100%] preprocessing
WARNING: autodoc: failed to import module 'common'; the following exception was raised:
No module named 'common'
WARNING: autodoc: failed to import module 'imputation'; the following exception was raised:
No module named 'imputation'
WARNING: autodoc: failed to import module 'imputation' from module 'src'; the following exception was raised:
No module named 'src'
WARNING: autodoc: failed to import module 'main'; the following exception was raised:
No module named 'main'
WARNING: autodoc: failed to import module 'preprocessing'; the following exception was raised:
No module named 'preprocessing'
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/gonzalo/tfmunir/RecommendationEngine/docs/modules.rst: WARNING: document isn't included in any toctree
done


并且生成的文档完全为空。

先感谢您。

最佳答案

可以通过在conf.py中包含以下行来解决此问题:

sys.path.insert(0, os.path.abspath(os.path.join('..','RecommendationEngine')))

关于python - Sphinx在make html之后找不到我的任何模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60243459/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com