Conda activate not working?

前端 未结 16 1442
失恋的感觉
失恋的感觉 2020-12-02 16:38
 gonzo  ~/a/packages  conda env list
# conda environments:
#
ppo_latest               /nohome/jaan/abhishek/anaconda3/envs/ppo_latest
root                  *  /noh         


        
相关标签:
16条回答
  • 2020-12-02 16:55

    Try this:

    export PATH=/home/your_username/anaconda3/bin:$PATH
    in ~/.bashrc
    

    Then source ~/.bashrc This works for me for the same problem.

    0 讨论(0)
  • 2020-12-02 16:55

    This solution is for those users who do not want to set PATH.

    Sometimes setting PATH may not be desired. In my case, I had Anaconda installed and another software with a Python installation required for accessing the API, and setting PATH was creating conflicts which were difficult to resolve.

    Under the Anaconda directory (in this case Anaconda3) there is a subdirectory called envs where all the environments are stored. When using conda activate some-environment replace some-environment with the actual directory location of the environment.

    In my case the command is as follows.

    conda activate C:\ProgramData\Anaconda3\envs\some-environment

    0 讨论(0)
  • 2020-12-02 16:58

    For windows, Use the Anaconda Powershell Prompt

    0 讨论(0)
  • 2020-12-02 16:59

    If nothing works for you, you can specify the full path of your python environment setup by conda.

    For me, I set up an environment called "testenv" using conda.

    I searched all python environments using

    whereis python | grep 'miniconda'
    

    It returned a list of python environments. Then I ran my_python_file.py using the following command.

    ~/miniconda3/envs/testenv/bin/python3.8 my_python_file.py
    

    You can do the same thing on windows too but looking up for python and conda python environments is a bit different.

    0 讨论(0)
  • 2020-12-02 17:01

    I just created a new environment with conda and things are different. My sys.path was not correct for a bit until I figured out way.

    As a result, I want to point out for anyone else confused by a change in conda, that if you have upgraded conda and created an environment, it will now tell you (as opposed to previous behavior):

    # To activate this environment, use
    #
    #     $ conda activate test
    #
    # To deactivate an active environment, use
    #
    #     $ conda deactivate
    

    Thus, the new way to activate/deactivate environments is to do it like the above.

    Indeed, if you upgrade from an older version of conda and you try the above, you may see the following helpful message (which I did):

    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
    If your shell is Bash or a Bourne variant, enable conda for the current user with
    
        $ echo ". ~/anaconda/etc/profile.d/conda.sh" >> ~/.bash_profile
    
    or, for all users, enable conda with
    
        $ sudo ln -s ~/anaconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
    
    The options above will permanently enable the 'conda' command, but they do NOT
    put conda's base (root) environment on PATH.  To do so, run
    
        $ conda activate
    
    in your terminal, or to put the base environment on PATH permanently, run
    
        $ echo "conda activate" >> ~/.bash_profile
    
    Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
    your ~/.bash_profile file.  You should manually remove the line that looks like
    
        export PATH="~/anaconda/bin:$PATH"
    
    ^^^ The above line should NO LONGER be in your ~/.bash_profile file! ^^^
    

    Changing the above fixed my issues with sys.path in activated conda environments.

    0 讨论(0)
  • 2020-12-02 17:01

    In the windows environment use "anaconda prompt" instead of "command prompt".

    0 讨论(0)
提交回复
热议问题