【发布时间】:2021-12-21 04:43:22
【问题描述】:
我遇到了以下问题,给我带来了很多麻烦。我设法在 2 1/2 小时后解决了这个问题,并且让一些可怜的灵魂免于浪费时间,我想展示我是如何解决它的。
在 .bat 文件中加载 python 文件通常效果很好。但是,我在尝试导入 pandas 时遇到了问题。 代码可能是这样的
import pandas as pd
print ("hello")
在 cmd 提示符下会出现以下结果
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
我的 .bat 文件看起来像
@echo off
"C:\Users\myUserName\Anaconda3\python.exe" "C:\path to .py file\MyPythonFile.py"
pause
【问题讨论】:
标签: python pandas batch-file import