'Python Script cannot run using Batch File
hihi, I just installed Anaconda3, and my script was able to run smoothly using Spyder. But when I call it using batch file, the below error is show:
C:\Users\Desktop>"C:\Users\anaconda3\python.exe" "C:\Users\Desktop\Testing.py"
C:\Users\anaconda3\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\Desktop\Testing.py", line 5, in <module>
import pandas as pd
File "C:\Users\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "C:\Users\anaconda3\python.exe"
* The NumPy version is: "1.20.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
C:\Users\Desktop>Pause
Press any key to continue . . .
My batch file is:
"C:\Users\anaconda3\python.exe" "C:\Users\Desktop\Testing.py"
Pause
and I have tried, uninstall numpy, uninstall pandas, then reinstall it also did not work. It did not work too when I downgrade the numpy to 1.19.2 version.
Not sure what's the reason causing this reason. Can anyone help?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
