User:Xyy23330121/Python/更多数字模式
< User:Xyy23330121 | Python
为了进行科学计算,我们要安装一些新的模块。这里提供两种方式来安装这些模块。
Anaconda
编辑Pandas、Scipy 模块均内置在一个特殊的 Python 发行版 Anaconda 里。读者可以通过下载并安装 Anaconda 来直接安装这些包。这也是这些模块的文档所推荐的安装方式。
PIP
编辑读者也可以参照之前教程中所述的方法,用 PIP 来安装这些模块。这些模块需要 Python 版本>= 3.9 才能安装。
matplotlib 和 numpy
编辑执行以下代码以安装 matplotlib:
python -m pip install -U matplotlib
如果在安装中出现了编译问题,可以尝试使用以下代码来安装预编译的版本:
python -m pip install -U matplotlib --prefer-binary
如果在安装中出现了连接问题,可以尝试使用清华大学的镜像服务器:
python -m pip install -U matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
在安装 matplotlib 时,numpy 作为依赖也会被安装。
Pandas
编辑执行以下代码以安装 pandas 和其所有可选功能:
python -m pip install pandas[all]
如果在安装中出现了连接问题,可以尝试使用清华大学的镜像服务器:
python -m pip install pandas[all] -i https://pypi.tuna.tsinghua.edu.cn/simple
如果在安装中出现了编译问题,可以尝试使用以下代码来安装预编译的版本:
python -m pip install pandas[all] --prefer-binary
在安装 pandas 时,scipy 作为依赖也会被安装。