如何解决Windows 命令提示符导入错误中的 Python Pandas:无法导入所需的依赖项:numpy (Anaconda)
我试图在 Windows 命令提示符下运行 python 脚本。该脚本在服务器环境中运行,由于我们公司的防火墙,该环境很难安装模块。所以使用包含python 3.8和Pandas等数据工程模块的Anaconda 3很方便。
脚本在 Spyder 和 Visual Studio 代码中运行没有问题,但是当我尝试在 Windows 命令行中运行它时,我收到以下错误:
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 "installservice.py",line 9,in <module>
import pandas as pd
File "C:\ProgramData\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.8 from "C:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.19.2"
脚本再次在我的 IDE 中运行没有问题,但在 Windows 命令行中没有问题。请帮忙
解决方法
尝试升级 pip,然后尝试卸载(如果它们已按以下顺序存在)。
pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。