我尝试了所有解决方案,包括设置导出路径等,但是都失败了。不确定我在做什么错。
我正在从命令行python sub/tests/branch1/demo/test_script.py
执行文件
在test_script中,它是从sub / sriptclass / demosripts / desc.py导入文件
但是,我不断收到找不到模块的错误。以前可以使用,但是更新我的电脑后,一切都搞砸了。
运行时
python sub/tests/branch1/demo/test_script.py
搜索导入的基本路径实际上是从sub / tests / branch1 / demo]开始>
然后在脚本执行时执行
->>找不到import sub.sriptclass.demosripts.desc.py
它将找到文件sub / tests / branch1 / demo / sub / sriptclass / demosripts / desc.py
在项目文件夹包括中创建test.py
文件
import sub.tests.branch1.demo.test_script
了解它