繁体   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