简体   繁体   中英

conda activate and conda.bat activate not activating virtual environment in Powershell

I've been trying to activate a virtual environment in Windows PowerShell and getting no response, and no environment change. This is what I've been getting:

PS C:\> conda activate Capstone
PS C:\> conda.bat activate Capstone
PS C:\> cd users\alexa
PS C:\users\alexa> activate Capstone
PS C:\users\alexa> conda activate Capstone
PS C:\users\alexa> activate.bat Capstone
PS C:\users\alexa> conda.bat activate capstone
PS C:\users\alexa> conda info --envs
# conda environments:
#
base                  *  C:\Anaconda3
Capstone                 C:\Anaconda3\envs\Capstone
env2                     C:\Anaconda3\envs\env2
env3                     C:\Anaconda3\envs\env3
project                  C:\Anaconda3\envs\project
tf2-1                    C:\Anaconda3\envs\tf2-1

PS C:\users\alexa> Get-ExecutionPolicy
AllSigned
PS C:\users\alexa>

Any ideas as to what the issue is?

Update: ran conda init, closed the powershell and reopened and still getting the same issue:

PS C:\Users\alexa> conda activate capstone
PS C:\Users\alexa> conda init
no change     C:\Anaconda3\Scripts\conda.exe
no change     C:\Anaconda3\Scripts\conda-env.exe
no change     C:\Anaconda3\Scripts\conda-script.py
no change     C:\Anaconda3\Scripts\conda-env-script.py
no change     C:\Anaconda3\condabin\conda.bat
no change     C:\Anaconda3\Library\bin\conda.bat
no change     C:\Anaconda3\condabin\_conda_activate.bat
no change     C:\Anaconda3\condabin\rename_tmp.bat
no change     C:\Anaconda3\condabin\conda_auto_activate.bat
no change     C:\Anaconda3\condabin\conda_hook.bat
no change     C:\Anaconda3\Scripts\activate.bat
no change     C:\Anaconda3\condabin\activate.bat
no change     C:\Anaconda3\condabin\deactivate.bat
no change     C:\Anaconda3\Scripts\activate
no change     C:\Anaconda3\Scripts\deactivate
no change     C:\Anaconda3\etc\profile.d\conda.sh
no change     C:\Anaconda3\etc\fish\conf.d\conda.fish
no change     C:\Anaconda3\shell\condabin\Conda.psm1
no change     C:\Anaconda3\shell\condabin\conda-hook.ps1
no change     C:\Anaconda3\Lib\site-packages\xontrib\conda.xsh
no change     C:\Anaconda3\etc\profile.d\conda.csh
no change     C:\Users\alexa\Documents\WindowsPowerShell\profile.ps1
no change     HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
No action taken.
PS C:\Users\alexa> conda activate capstone
PS C:\Users\alexa>

Make sure you have ran "conda init" on your powershell. That should initialize that shell to use conda environments. After that you may have to reopen the shell and then it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM