pip install xxxxx
如果想下载 numpy 库,在cmd下则输入:pip install numpy
pip uninstall xxxxx
如果想卸载 numpy 库,在cmd下则输入:pip uninstall numpy
在cmd下输入:pip list
pip install -U xxxxx 或者 pip install xxxxx --upgrade
如果想升级 numpy 库,在cmd下则输入:pip install -U numpy
(第二种方法也可以)
如果想升级 pip ,在cmd下则输入:pip install -U pip
(第二种方法也可以)
pip show -f xxxxx
如果想查看 numpy 所在的目录,在cmd下输入:pip show -f numpy,在我的电脑下为:
pip search xxxxx
如果想查找 numpy 库,则在cmd下输入:pip search numpy,可以查找关于 numpy 库的一些信息。
在cmd下输入:pip list -o
pip安装时会很慢,通过换源可以使安装速度变快
以下是几个国内的源:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
使用方法为:可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy,这样就会从清华这边的镜像去安装numpy库。
conda install xxxxx
如果想下载 numpy 库,则在 Anaconda Prompt 中输入:
conda install numpy
conda uninstall xxxxx 或者 conda remove xxxxx
如果想卸载 numpy 库,则在 Anaconda Prompt 中输入:
conda uninstall numpy(第二种方法也可以)
在 Anaconda Prompt 中输入:
conda list
conda update xxxxx
如果想更新 numpy 库,则在 Anaconda Prompt 中输入:
conda update numpy
如果要更新所有包,则在 Anaconda Prompt中输入:
conda update --all
conda search xxxxx
如果想搜索 numpy 库,则在 Anaconda Prompt 中输入:
conda search numpy
如果想在 python 3.6 的环境下创建一个 python 3.5 的环境,则在
Anaconda Prompt 中输入:
conda create -n py python=3.5
其中 py 为环境的名称(也可以写别的名称),python=3.5 为指定的python环境(也可以改为其他python版本)。
如果想进入 python 3.5 的环境,则在 Anaconda Prompt 写:
activate py
py 代表的是环境的名称,此时再安装其他第三方库时,就将该库装到了3.5的环境中。
在 Anaconda Prompt 中输入:deactivate
在 Anaconda Prompt 中输入:conda env list
在 Anaconda Prompt 中输入:conda env remove -n py,这里的 py 是指环境名称。
conda create -n data python=3.5 numpy pandas
这句命令的意思是:创建一个带有 numpy、pandas库 的 python3.5的环境,这个环境的名称为data。
清华大学conda源的使用方法:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
换源后安装第三方库的速度就会快很多。