【问题标题】:im new to coding itself so i want to know how to fix this [duplicate]我是编码本身的新手,所以我想知道如何解决这个问题[重复]
【发布时间】:2021-05-25 19:29:20
【问题描述】:
x = 10

print(x)

我收到的信息:

PS H:\VS Code\100 Days of Code\Day16 - OOP> conda activate base
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.       

At line:1 char:1

+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

 
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32


Warning:

not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation


 
  File "<stdin>", line 1, in <module>
NameError: name 'X' is not defined


>>> print(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'x' is not defined
>>>

【问题讨论】:

  • 对你有好处!尝试学习一些编码...看来您确实安装了python,但我不确定它是否与您从虚拟环境中调用它有关。请对警告中提供的链接进行一些研究并更新您的问题,并发布您尝试修复它的方式。

标签: python visual-studio-code anaconda


【解决方案1】:

这是一个一般性错误,表明 conda 没有安装,或者至少在您尝试运行它的命令行中无法访问它。它与 Python 无关。

我不确定您为什么要使用 conda 来执行此任务,但我认为它与 100 Days of Code 的事情有关?

该程序是否为您提供了一些有关如何设置环境的说明?也许再试一次。

您还可能会发现使用专用的 python 编辑器有一些好处,它可以让您在不运行 Powershell 的情况下处理您的 python 文件。

如果您确定 Powershell + Conda 是正确的,则需要安装 Conda,并将其公开到 powershell 路径。

【讨论】:

  • 我现在让它工作了,似乎我尝试使用 shift+enter 来运行代码,这导致它无法工作,但是在我使用运行按钮在终端中运行它之后它似乎工作现在
猜你喜欢
  • 2021-07-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-22
  • 1970-01-01
  • 2021-01-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多