any way to tell if user's python environment is anaconda

前端 未结 3 1440
暖寄归人
暖寄归人 2021-02-08 03:40

i\'m distributing an in-house python lib where i\'d like to make it such that if the user is using anaconda when running this file, that updates to the dependencies of the libra

3条回答
  •  北海茫月
    2021-02-08 03:52

    I'm from Continuum, so let me make a quick note: You'll get a different sys.version string depending on whether you used conda to install the Anaconda Python Distribution or simply Python. So from conda create -n full_apd anaconda you'd get a sys.version string as follows:

    $ python -c "import sys; print sys.version"
    2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Jan 10 2014, 11:23:15) 
    [GCC 4.0.1 (Apple Inc. build 5493)]
    

    This is what you get if you use miniconda or are working from a conda environment where you have just specified python (e.g. conda create -n base_py27 python=2.7):

    $ python -c "import sys; print sys.version"
    2.7.6 |Continuum Analytics, Inc.| (default, Jan 10 2014, 11:23:15) 
    [GCC 4.0.1 (Apple Inc. build 5493)]
    

    If you have simply downloaded and installed the full Anaconda Python Distribution directly, you'll get the former:

    $ python -c "import sys; print sys.version"
    2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Jan 10 2014, 11:23:15) 
    [GCC 4.0.1 (Apple Inc. build 5493)]
    

提交回复
热议问题