• 0320-Anoconda入门


    Conda在Windows上的使用

    前言

    • 基础,必学

      Having been involved in the python world for so long, we are all aware of pip, easy_install, and virtualenv, but these tools did not meet all of our specific requirements. The main problem is that they are focused around Python, neglecting non-Python library dependencies, such as HDF5, MKL, LLVM, etc., which do not have a setup.py in their source code and also do not install files into Python’s site-packages directory.
      So Conda is a packaging tool and installer that aims to do more than what pip does; handle library dependencies outside of the Python packages as well as the Python packages themselves. Conda also creates a virtual environment, like virtualenv does.
      As such, Conda should be compared to Buildout perhaps, another tool that lets you handle both Python and non-Python installation tasks.
      Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side but they do not interoperate either.

    参考

    anaconda官方文档
    conda cheet sheet
    Conda Docs
    Anaconda package list
    Conda 半小时入门操作
    PYTHON PACKAGES AND ENVIRONMENTS WITH CONDA
    Jupyter Notebook interact widgets

    学习内容

    Conda常识

    • Conda虽然是一个包管理工具,但是不通过conda install的包貌似不能在conda list中显示出来
    • 手动通过setup.py安装的包,不能在conda list中显示
    • 除了package management功能之外,还有环境创建和管理功能,另外还提供Jupyter notebook神器,spyder IDE等。

    手动安装的包不能list出来

    conda package --untracked
    # 可以查看文件以查看哪些包已经安装了

    Python 2 or Python 3

    • conda update moves up to the latest compatible version, while conda install can be used to install any version. For example, if Python 2.7.7 is currently installed but the latest version of Python 2 is 2.7.12 and the latest version of Python 3 is 3.5.2, then conda update python will install Python 2.7.12, while conda install python=3will install Python 3.5.2. Conda uses the same rules for other packages, so conda install can always install the highest version, and conda update will always install the highest version with the same major version number.

    Conda常用命令

    conda list
    conda update
    conda update anoconda
    conda update --all
    conda info
    conda info --envs
    # 搜索
    conda search beautifulsoup4
    # 从网站下载安装包
    conda install --channel https://conda.anaconda.org/pandas bottleneck 
    # 创建和激活环境
    conda create --name snowflakes biopython
    activate snowflakes
    # 第二个环境,python版本变化,包含两个包
    conda create --name bunnies python=3 astroid babel
    # 复制一个环境
    conda create --name flowers --clone snowflakes
    # 切换环境
    activate bunnies
    deactivate
    # 删除环境
    conda remove --name flowers --all
    # 删除包
    conda remove --name bunnies iopro
    # 重置环境,会删除所有缓存的包,文件,源代码等
    conda clean --all

    安装non-conda包

    • 使用pip
    • 使用传统的setup.py

    windows下添加环境变量

    D:ProgramDataAnaconda3
    D:ProgramDataAnaconda3Scripts
    D:ProgramDataAnaconda3Libraryin

    Python 路径下文件夹含义

    • Jupyter基本配置

    jupyter notebook --generate-config
    # 生成配置文件,查看配置文件路径
    # 打开 users/zhens/.jupyter/jupyter_notebook_config.py
    # 搜索 # The directory to use for notebooks and kernels.
    c.NotebookApp.notebook_dir = u'E:Master-Thesis'
  • 相关阅读:
    Linux strace命令
    Xilinx实习一年总结
    Red Hat Linux 挂载外部资源
    4.6、Libgdx线程介绍
    Xshell中文乱码怎么处理?
    C++之指针指向二维数组
    POJ 2996 Help Me with the Game
    UVa 10377
    你们都满足下面的工作考核吗
    使用Python编写简单网络爬虫抓取视频下载资源
  • 原文地址:https://www.cnblogs.com/lizhensheng/p/11183643.html
Copyright © 2020-2023  润新知