zoukankan      html  css  js  c++  java
  • conda和pip环境管理

    1、anaconda换源

    制定清华的源:
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    有资源显示源地址:
    conda config --set show_channel_urls yes
     

    2、创建一个名为python36的环境,指定Python版本是3.6

    conda create --name python36 python=3.6

    3、激活某个环境

    activate python36 # for Windows

    source activate python36 # for Linux & Mac

    deactivate python36 # for Windows

    source deactivate python36 # for Linux & Mac

    4、 删除一个已有的环境

    conda remove --name python36 --all

    5、conda包管理

    5.1安装xxxx

    conda install xxxx 

    5.2查看当前环境下已安装的包

    conda list 

    5.3查看某个指定环境的已安装包

    conda list -n python36 

    5.4查找package信息

    conda search numpy

    5.5安装package

    conda install -n python34 numpy # 如果不用-n指定环境名称,则被安装在当前活跃环境 也可以通过-c指定通过某个channel安装

    6、Conda 更新 

    6.1 更新package

    conda update -n python34 numpy

     6.2 删除package

    conda remove -n python34 numpy

     6.3 更新conda,保持conda最新

    conda update -n base conda

     6.4 更新anaconda

    conda update anaconda

     6.5 更新python

    conda update python 

    7、pip使用

     # pip安装包

    $ pip install SomePackage

    [...]

      Successfully installed SomePackage

    # pip查看已安装的包

    $ pip show --files SomePackage

      Name: SomePackage

      Version: 1.0

      Location: /my/env/lib/pythonx.x/site-packages

      Files:

       ../somepackage/__init__.py

       [...]

    # pip检查哪些包需要更新

    $ pip list --outdated

      SomePackage (Current: 1.0 Latest: 2.0)

    # pip升级包

    $ pip install --upgrade SomePackage

      [...]

      Found existing installation: SomePackage 1.0

      Uninstalling SomePackage:

        Successfully uninstalled SomePackage

      Running setup.py install for SomePackage

      Successfully installed SomePackage

    # pip卸载

    $ pip uninstall SomePackage

      Uninstalling SomePackage:

        /my/env/lib/pythonx.x/site-packages/somepackage

      Proceed (y/n)? y

      Successfully uninstalled SomePackage

     
  • 相关阅读:
    【转】Git: There is no tracking information for the current branch.
    【转】git多个远程仓库
    【转】python批量快速合并excel文件
    【转】HTML5-postMessage实现跨域
    Python3正则表达式search和findall差异讨论
    Python Segmentation fault错误定位办法
    Python3压缩和解压缩实现
    Python3+profile性能分析
    案例:ADG环境遇到redo日志member路径有误以及RMAN-6571错误
    CentOS7的udev的绑定规则
  • 原文地址:https://www.cnblogs.com/joxin/p/9700721.html
Copyright © 2011-2022 走看看