我有一个名为项目目录设置是这样的:名为无模块 '...' 蟒蛇
项目
--directory:src--
--directory:testscripts--
--directory:config_files--
RunPCS.py
和src内,它被设置为:
SRC
parse_files.py
parse_json.py
process_xml.py
__init__.py
在RunPCS.py我有from src.parse_files import parse_files
和 from src.parse_json import parse_json
在parse_json.py我有from process_xml import process_xml
(因为它们是在同一目录)
,但我得到的错误no module named process_xml
。有谁知道为什么这个错误出现?
请具体说明哪些版本的Python - 相对导入规则不同。看,即。 https://docs.python.org/2.5/whatsnew/pep-328.html - 在2.5中引入显式的相对导入语法(您可能应该在这里使用它)。 –
我正在使用python 3.4 –