conda looking for library outside activate environment

后端 未结 2 324
太阳男子
太阳男子 2021-01-20 13:25

I am working on Windows, I find a difference in import behavior about conda created environment which I cannot understand, here the details

Case 1 (Success)

2条回答
  •  离开以前
    2021-01-20 13:52

    You need to activate your environment. See that:

    (base) C:\> conda activate 
    (env-name) C:\> python
    >>> import numpy
    (Success)
    

    There is a (base)which means that the active environment name is based. Try doing conda info --envs

    to se a list of environments.

    When you do:

    C:\> cd 
    C:\path-to-conda-env> python
    >>> import numpy
    (Fail)
    

    You are navigating to the folder of the environment but you are not using the python environment that it holds.

    Try using:

    which python
    

    to see which python version you are using.

提交回复
热议问题