我在numpy
中使用python3
进行数学项目。今天,我想使用numpy.integrate.quad
,但你可以看到下面的错误和进一步的尝试。 import numpy
始终有效。那么问题是什么?
$ python
Python 3.6.1 (default, Mar 27 2017, 00:27:06)
[GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import numpy.integrate as integrate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy.integrate'
>>> import scipy.integrate as integrate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'
>>> from numpy import integrate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'integrate'
>>> from scipy import integrate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'
>>> from numpy.integrate import quad
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy.integrate'
>>> from numpy import integrate.quad
File "<stdin>", line 1
from numpy import integrate.quad
Numpy似乎安装正确,但我仍然无法使用numpy.integrate。我在搞乱进口吗?
答案 0 :(得分:1)
from scipy.integrate import quad
numpy没有integrate
包;这些都在交付的scipy
部分。