簡體   English   中英

導入 numpy 時出錯,即使我安裝正確

[英]Error importing numpy even though I installed it properly

我正在使用一個名為investpy 的模塊,numpy 是它的依賴項。 我嘗試運行 pip installinvestpy,它安裝了所有依賴項(或者它說)。 但是,當我嘗試跑步時

import numpy

或者

import investpy

,我面臨這個錯誤:

    Traceback (most recent call last):
  File "C:\Users\kakor\OneDrive\Desktop\ML\numpy\__init__.py", line 124, in <module>
    from numpy.__config__ import show as show_config
ModuleNotFoundError: No module named 'numpy.__config__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\kakor\OneDrive\Desktop\ML\stockscreener.py", line 1, in <module>
    import numpy
  File "C:\Users\kakor\OneDrive\Desktop\ML\numpy\__init__.py", line 129, in <module>
    raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

我真的很困惑為什么會這樣,因為據我所知,我正確安裝了 numpy。 此外,這真的很奇怪,因為如果我將 go 到 cmd 目錄中的 python 目錄並運行 import Z2EA9510C37F7F821CBZF1 它完美工作。FF7562

任何幫助將不勝感激。 謝謝!

本質上 numpy 似乎抱怨它不是從標准路徑導入的。 看起來您將 numpy 直接安裝到 C 下的項目目錄C:\Users\kakor\OneDrive\Desktop\ML\numpy您應該刪除該目錄並嘗試運行

pip install numpy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM