zoukankan      html  css  js  c++  java
  • vscode调试python时提示无法将“conda”项识别为 cmdlet、函数、脚本文件或可运行程序的名称的解决方法

    (1)vscode在调试python文件时提示如下信息:
    conda : 无法将“conda”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
    在这里插入图片描述

    解决办法:
    没有添加系统变量,所以系统根本识别不了conda命令,找不到位置。
    添加以下系统变量即可正常运行:
    添加对应Anaconda环境变量到用户变量中:(以自己的安装路径为准)
    D:Anaconda
    D:AnacondaScripts
    D:AnacondaLibraryin
    在这里插入图片描述

    如果重启vscode调试后还是报错并提示下面的信息:
    PS D:Python> D:/Anaconda/Scripts/activate PS D:Python> conda activate base 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 ". D:Anaconda/etc/profile.d/conda.sh" >> ~/.bashrc or, for all users, enable conda with $ sudo ln -s D: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" >> ~/.bashrc Previous to conda 4.4, the recommended way to activate conda was to modify PATH in your ~/.bashrc file. You should manually remove the line that looks like export PATH="D:Anaconda/bin:$PATH" ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
    这是按照之前的方法在做一遍,不过这次是把之前那三个路径添加到系统变量的path下!
    在这里插入图片描述

    (2)vscode切换虚拟环境报错无法加载文件 E:Python_projectshop_envScriptsActivate.ps1,因为在此系统上禁止运行 脚本:
    在这里插入图片描述

    解决方法如下:
    Windows+x打开面板,选择以管理员身份运行PowerShell,输入: set-executionpolicy remotesigned,接下来输入“y”表示执行。
    在这里插入图片描述
    在这里插入图片描述

    (3) VScode中还是出错?
    在这里插入图片描述

    因为默认此处是PowerShell,选成cmd,即可!

    愿你一寸一寸地攻城略地,一点一点地焕然一新
  • 相关阅读:
    Code Forces 650 C Table Compression(并查集)
    Code Forces 645B Mischievous Mess Makers
    POJ 3735 Training little cats(矩阵快速幂)
    POJ 3233 Matrix Power Series(矩阵快速幂)
    PAT 1026 Table Tennis (30)
    ZOJ 3609 Modular Inverse
    Java实现 LeetCode 746 使用最小花费爬楼梯(递推)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
  • 原文地址:https://www.cnblogs.com/nmydt/p/14493789.html
Copyright © 2011-2022 走看看