Pythonにnumpyは入っているか?
- Python Shellを使い、numpyが入っているかを確認します。
ImportError: No module named 'numpy'
と表示されました。どうやらnumpyは入っていないようです…。
numpyをインストールしよう
C:\>pip install numpy
Collecting numpy
Downloading numpy-1.13.3-2-cp35-none-win32.whl (6.8MB)
100% |################################| 6.8MB 31kB/s
Installing collected packages: numpy
Successfully installed numpy-1.13.3
numpyをimportして使ってみよー!
- numpyのmathモジュールをimportします。Python Shellを使用します。
>>> from numpy import math
>>> math.sqrt(16)
4.0
参考
- numpyを使って、中学・高校で習った数学の問題に再挑戦してはいかがでしょうか。
- numpyにどんな関数があるのか下記の記事が参考になります。
NumPy で数学系の関数を使ってみよう – Python でデータサイエンス