简体   繁体   English

批处理依次运行多个链接的 python 脚本,但找不到 NumPy 模块,也无法使用其他文件结果

[英]batch to run multiple linked python scripts sequentially, and no NumPy module found, also cannot use another file results

I have multiple python scripts, py1 results used to calculate py2 results, py2 results used to calculate py3 results...我有多个python脚本,py1结果用来计算py2结果,py2结果用来计算py3结果...

trying to use bat to run these files py1 first and py2 second....... It always shows NumPy not found, also cannot use the results of another script.尝试使用 bat 首先运行这些文件 py1,然后再运行 py2.......它总是显示 NumPy 未找到,也无法使用另一个脚本的结果。 Anyone can help, really appreciated.任何人都可以提供帮助,真的很感激。 Thanks谢谢

Code: My python scripts example:代码:我的 python 脚本示例:

py1: d = int(7) def task(): return int(d) d1 = task() py1: d = int(7) def task(): return int(d) d1 = task()

py2: from py1 import d1 py2: 从 py1 导入 d1

def task_1():
   h =5
   g2 =h+d1
   return g2

g2 = test_1()

py3: from py2 import g2 py3: 从 py2 导入 g2

My Bat file code like this:我的Bat文件代码是这样的:

@echo off

"C:\Users\name\Anaconda3\python.exe" "C:\Users\name\Desktop\test_auto\py1.py" & "C:\Users\name\Desktop\test_auto\py2.py" & "C:\Users\name\Desktop\test_auto\py3.py" & pause

Make sure you have had imported NumPy in all your python files.确保您已在所有 python 文件中导入 NumPy。 Also here's a link to import the variables from other python file: Import Variable from Python FilePath这里还有一个从其他 python 文件导入变量的链接:从 Python FilePath 导入变量

Hope I had helped you, If you have any question, you can reply me.希望对你有所帮助,有什么问题可以回复我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用批处理文件同时运行多个python脚本 - How to use batch file to run multiple python scripts simultaneously Best method to run multiple python scripts sequentially from a single file and show print statememts from each? - Best method to run multiple python scripts sequentially from a single file and show print statememts from each? 如何按顺序运行多个 python 脚本? - How do I run multiple python scripts sequentially? 如何在窗口xp / 7中从批处理文件调用/运行多个python脚本 - how to call / run multiple python scripts from batch file in window xp / 7 同时运行多个Python脚本然后按顺序运行 - Running multiple Python scripts simultaneously and then sequentially 使用我的 anaconda 环境运行 windows 批处理文件以调用 python 脚本 - Run windows batch file to call on python scripts with my anaconda environment Windows Run 无法找到 Al Sweigart 的“使用 Python 自动化无聊的东西”第 6 章中“mclip”的批处理文件 - Batch File for "mclip" in Chapter 6 from Al Sweigart's "Automate the Boring Stuff with Python" cannot be found by Windows Run 使用python子进程模式在批处理文件中运行另一个批处理文件 - Run Another batch file in a batch file using python subprocess mode python运行多个脚本 - python run multiple scripts Django可以使用链接到其他库(NumPy,RPy2…)的“外部” python脚本吗? - Can Django use “external” python scripts linked to other libraries (NumPy, RPy2…)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM