简体   繁体   English

ModuleNotFoundError:没有名为“scipy.optimize”的模块

[英]ModuleNotFoundError: No module named 'scipy.optimize'

from scipy.optimize import curve_fit
from matplotlib import pyplot

The error I'm running into is this-我遇到的错误是 -

Traceback (most recent call last):
File "H:/Hrishikesh1/best_fit.py", line 4, in <module>
from scipy.optimize import curve_fit
ModuleNotFoundError: No module named 'scipy.optimize' 

What can I do to fix this?我该怎么做才能解决这个问题?

Additional info - This was the output when I installed the scipy package using pip -附加信息 - 这是 output 当我使用 pip 安装 scipy package -

Installing collected packages: scipy
Successfully installed scipy-1.9.1
WARNING: Ignoring invalid distribution -cipy 
(c:\users\workstation2\appdata\local\programs\python\python310\lib\site- 
packages)

WARNING: Ignoring invalid distribution -cipy 
(c:\users\workstation2\appdata\local\programs\python\python310\lib\site- 
packages)

WARNING: Ignoring invalid distribution -cipy 
(c:\users\workstation2\appdata\local\programs\python\python310\lib\site- 
packages) 

I made a test file with the first line of your code to see if I get the same error.我用你的代码的第一行做了一个测试文件,看看我是否得到同样的错误。 I did not get the same error using python 3.9.12, numpy 1.23.1 and scipy 1.9.1.使用 python 3.9.12、numpy 1.23.1 和 scipy 1.9.1 时,我没有遇到同样的错误。 I also do not get the same warnings when installing scipy. This might be a problem related to a newer python version for which scipy is not compatible yet.安装 scipy 时,我也没有收到相同的警告。这可能是与更新的 python 版本相关的问题,scipy 尚不兼容。 However, I do not know why it doesn't work for you.但是,我不知道为什么它对您不起作用。 I do know that these versions work.我知道这些版本有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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