In the CONDA environment using vs code, running the program will report the following problems
conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
After online search, the solution is as follows. Method 2 can be used for pro test:
Method 1:
Use the anaconda navigator or Anaconda PowerShell prompt provided by Anaconda to enter the environment, or enter CONDA Bat activate “environment path”, such as CONDA batactivate”D:\Anaconda3\envs\test”
Method 2:
Step 1:
Open the administrator power shell, modify the execution policy, execute: get executionpolicy, reply restricted, indicating that the status is prohibited
Restricted – default setting, no scripts are allowed to run
allsigned – only scripts signed by digital certificates can be run
remotesigned – local scripts do not need digital signatures, but scripts downloaded from the network must have digital signatures
unrestricted – all scripts are allowed to run
Step 2:
Execute: set executionpolicy remotesigned
Step 3:
Input: CONDA init
At this time, the configuration file profile will be generated under C:\users\XXX\documents\windowspowershell ps1
After restarting the power shell or vs code, it will enter the base environment of CONDA by default
Recovery:
Delete profile ps1.
According to personal conditions, execute the set executionpolicy restricted policy and change it back to restricted.
Read More:
- [Solved] CONDA ENV create and run Error: F environment.yml under win10
- [Solved] Error when vscode activates Python virtual environment
- [Solved] MAC terminal Use ‘CONDA activate’ and ‘CONDA install package_ Error reported by name’ Error
- [Solved] conda install DBUtils Error: To search for alternate channels that may provide the conda package you’re looking for
- [Solved] VScode Configurate Python Interpreter Error: D:\Pros\virtuals\venvs\Scripts\Activate.ps1 cannot be loaded
- [Solved] Conda Upgrade Error: PackageNotInstalledError: Package is not installed in prefix.
- [How to Solve] ERROR: Input: conda activate xxx
- VScode import numpy Error: DLL load failed [How to Solve]
- [Solved] CONDA Error: Collecting package metadata (current_repodata.json): failed…
- [Solved] ProxyError: Conda cannot proceed due to an error in your proxy configuration.
- Python3.6 Run uvicorn Error: AttributeError: module ‘asyncio‘ has no attribute ‘run‘
- Conda Install Library Error: failed with initial frozen solve. Retrying with flexible solve.
- [Solved] Failed environment install leads to “unable to create process using“ error
- Pytorch: How to Handle error warning conda.gateways.disk.delete:unlink_or_rename_to_trash(140)
- Vscode Tensorboard Error: We failed to start a TensorBoard session due to the following error: Command fa
- [Solved] Conda install Error: An HTTP error occurred when trying to retrieve this URL. HTTP errors are often…
- Pychar can’t connect to Python console, but it can run. Py file, and Anaconda’s command line can run Python command
- [How to Fix]RuntimeError: Python is not installed as a framework, If you are using (Ana)Conda
- [Solved] CONDA installs scikit-learn 0.24 Error: LinkError
- How to Solve pycharm terminal Failed to switch to virtual environment