- 安装Numpy
因为使用biopython需要numpy的支持,所以需要先安装numpy。安装numpy过程如下:去numpy官网下载numpy,
关于numpy:https://www.runoob.com/numpy/numpy-tutorial.html
numpy官网: http://www.numpy.org/
若先安装biopython会有如下报错
$ pip install biopython
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/biopython/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/biopython/
Collecting biopython
Downloading biopython-1.76-cp38-cp38-macosx_10_9_x86_64.whl (2.3 MB)
|████████████████████████████████| 2.3 MB 17 kB/s
ERROR: Could not find a version that satisfies the requirement numpy (from biopython) (from versions: none)
ERROR: No matching distribution found for numpy (from biopython)
2.numpy安装过程
(1)使用 pip 安装
安装 NumPy 最简单的方法就是使用 pip 工具:
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
--user 选项可以设置只安装在当前的用户下,而不是写入到系统目录。
若出现No module named pip
Pyhton 3.8, macos 10.14
使用python3-pip;不是python pip
(2) Mac 系统
Mac 系统的 Homebrew 不包含 NumPy 或其他一些科学计算包,所以可以使用以下方式来安装:
python -m pip install numpy scipy matplotlib
安装验证
测试是否安装成功:
>>> from numpy import *
>>> eye(4)
array([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
from numpy import 为导入 numpy 库。
eye(4) 生成对角矩阵。
网友评论