如何在 Python 中导入 Scipy 和 Numpy?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37585601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:35:24  来源:igfitidea点击:

How to import Scipy and Numpy in Python?

pythonnumpyscipy

提问by Masan

I am very new to Python and want to add Numpy and Scipy module. I think my question is very simple for you. I am using Python 3.06a.1 version. I think I already installed something called Anaconda that contains those library. When I type import scipy I get the following message:

我对 Python 很陌生,想添加 Numpy 和 Scipy 模块。我想我的问题对你来说很简单。我正在使用 Python 3.06a.1 版本。我想我已经安装了包含这些库的名为 Anaconda 的东西。当我输入 import scipy 时,我收到以下消息:

import scipy
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    import scipy
ImportError: No module named 'scipy'

also when I want to installed with command line I get the following message which means that I have it already.

此外,当我想用​​命令行安装时,我收到以下消息,这意味着我已经有了它。

   localhost:~ user$ pip install scipy
Requirement already satisfied (use --upgrade to upgrade): scipy in ./anaconda/lib/python3.5/site-packages
localhost:~ user$ 

Please help me to fix this problem

请帮我解决这个问题

采纳答案by Pierre-Louis Sauvage

You shouldn't have problem with scipy and numpy if you installed Anaconda. What I'm advising you may sound stupid, but I'm sure it has a good chance to solve your problem.

如果你安装了 Anaconda,你应该不会遇到 scipy 和 numpy 的问题。我的建议可能听起来很愚蠢,但我相信它很有可能解决您的问题。

Relaunch Anaconda, reboot your computer, reinstall Anaconda.

重新启动 Anaconda,重新启动计算机,重新安装 Anaconda。

Edit : also watch out to use "scipy" and not "spicy" as I just witnessed in your logs.

编辑:还要注意使用“scipy”而不是“spicy”,正如我刚刚在您的日志中所见。

回答by jlarsch

if you are using anaconda, try installing scipy using anaconda:

如果您使用的是 anaconda,请尝试使用 anaconda 安装 scipy:

conda install scipy