简体   繁体   中英

Python Pandas in Windows Command Prompt ImportError: Unable to import required dependencies: numpy (Anaconda)

I am trying to run a python script off the Windows command prompt. The script runs in a server environment which is a tough place to install modules because of our companies firewalls. So It was convenient to use Anaconda 3 which includes python 3.8 and Data engineering modules like Pandas.

The script runs with no issue in Spyder and Visual Studio code, but when I try to run it in the Windows Command line I get the following error:

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"

Again the script runs with no issues in my IDEs but not on Windows Command Line. Please help

Try upgrading the pip and then try to uninstall if they are already present in the below order.

pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM