简体   繁体   English

NameError:名称“go”未在 sublime text 3 控制台中定义

[英]NameError: name 'go' is not defined in sublime text 3 console

I follow some webpage's instructions to install Sublime Text 3 and use package control to install Gosublime, then change its user-default file:我按照一些网页的说明安装 Sublime Text 3 并使用 package 控件安装 Gosublime,然后更改其用户默认文件:

{
   "env": {
       "GOROOT": "d:\\go",
       "GOPATH": "d:\\go\workspace",
       "path: "d:\\go\\workspace\\bin"
   }
}

where d:\go is the golang environement I downloaded and installed earlier, d:\go is the workspace I established.其中 d:\go 是我之前下载并安装的 golang 环境,d:\go 是我建立的工作空间。 Now I want to install gocode.现在我想安装gocode。 I restart Sublime Text 3, then show console.我重新启动 Sublime Text 3,然后显示控制台。 Wen I enter文我进入

git get github.com/nsf/gocode

It shows:表明:

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

Below is the complete console log for reference:以下是完整的控制台日志供参考:

GoSublime init r17.02.16-1 (0.001s)
|   install margo: no
|   install state: done
| sublime.version: 3126
| sublime.channel: stable
|       about.ann: a17.02.16-1
|   about.version: r17.02.16-1
|         version: r17.02.16-1
|        platform: windows-x64
|            ~bin: ~\AppData\Roaming\Sublime Text 3\Packages\User\GoSublime\windows-x64\bin
|       margo.exe: ~bin\gosublime.margo_r17.02.16-1_go1.8.exe (ok)
|          go.exe: d:\go\bin\go.exe (ok)
|      go.version: go1.8
|          GOROOT: d:\go
|          GOPATH: d:\go\workspace
|           GOBIN: (not set) (should usually be `(not set)`)
|       set.shell: []
|       env.shell:
|       shell.cmd: ['C:\\windows\\system32\\cmd.exe', '/C', '${CMD}']
--------------------------------

Package Control: Skipping automatic upgrade, last run at 2017-02-23 14:07:30, next run at 2017-02-23 15:07:30 or after
>>> go
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'go' is not defined
>>> go get github.com/nsf/gocode
  File "<string>", line 1
    go get github.com/nsf/gocode
         ^
SyntaxError: invalid syntax

But if I run cmd.com and enter same command, it runs ok.但是如果我运行 cmd.com 并输入相同的命令,它运行正常。 What do I miss?我想念什么?

The Sublime Text console is not a terminal, it's a python shell. Sublime Text控制台不是终端,而是python shell。 You can run python command, not bash (windows) commands. 您可以运行python命令,而不是bash(windows)命令。

As said @keith Hall in his command, to run bash commands, you need some build systems . 如@keith Hall在其命令中所述,要运行bash命令,您需要一些构建系统 I don't believe that's the solution to your problem, though, since you only want to run this command once, no? 但是,我不认为这是解决问题的方法,因为您只想运行一次此命令,不是吗? If it's the case, you might want to look at sublimeREPL , although I'd recommend simply using a regular terminal. 如果是这种情况,尽管我建议只使用常规终端,您可能要看一下sublimeREPL

Just a quick overview: 简要概述:

Build systems are super useful to run for example python program. 构建系统对于运行例如python程序非常有用。 A really simple build system like this: 一个非常简单的构建系统,如下所示:

{
    "cmd": ["python", "$file"]
}

will run the currently opened file when triggered. 触发时将运行当前打开的文件。

For more about build system, there's probably no better resource than the unofficial documentation 有关构建系统的更多信息,可能没有比非官方文档更好的资源了

You have to add this line import plotly.graph_objects as go .您必须添加这一行import plotly.graph_objects as go #Python #Python

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NameError:名称“beam”未在中定义<lambda></lambda> - NameError: name 'beam' is not defined in <lambda> NameError:未定义名称“funt1”[在运行“format data-ptransform-40”时] - NameError: name 'funt1' is not defined [while running 'format data-ptransform-40'] NameError:未定义名称“datetime”[在运行“ChangeDataType DistrictAllocationAndListStore-ptransform-570”时] - NameError: name 'datetime' is not defined [while running 'ChangeDataType DistrictAllocationAndListStore-ptransform-570'] NameError:未定义名称“athena”,从另一个 jupyter notebook 导入 athena 查询 function 时 - NameError: name 'athena' is not defined , when importing athena query function from another jupyter notebook NameError("name 'engine' is not defined",) 在雪花连接器中使用 pd_writer 方法运行时 - NameError("name 'engine' is not defined",) while running using pd_writer method in snowflake-connector 如何测试是否定义了 Go 模板块? - How to test if a Go template block is defined? 未定义的名称“DefaultfirebaseOptions”。 尝试将名称更正为已定义的名称,或定义名称 - Undefined name 'DefaultfirebaseOptions'. Try correcting the name to one that is defined, or defining the name 未使用 boto 定义全局名称“s3”? - global name 's3' not defined using boto? 在 NodeJS 中遇到“ReferenceError: calendar is not defined”,但相同的代码在 Google 的 API 测试控制台中有效 - "ReferenceError: calendar is not defined" encountered in NodeJS but same code works in API Test Console in Google 名称“Key”未定义用于访问 DynamoDB 的 Lambda 函数 - Name 'Key' not defined Lambda function to access DynamoDB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM