如何在Windows上安装go-sql-driver

huangapple go评论88阅读模式
英文:

How to install go-sql-driver on Windows

问题

我正在尝试在Windows Vista上安装go-sql-driver,但是我在GOPATH方面遇到了问题。

我按照建议安装了git,并在Windows中将GOPATH作为新的用户环境添加到路径C:/users/A/desktop/go中。

我在命令行中运行go get github.com/go-sql-driver/mysql,但是它给我返回了以下错误:

C:\>go get github.com/go-sql-driver/mysql
go: missing Git command. See http://golang.org/s/gogetcmd
package github.com/go-sql-driver/mysql: exec: "git": executable file not found in %PATH%

当我查看http://golang.org/s/gogetcmd时,它只是说要下载git。但是我已经在我的机器上下载了git。

我还创建了一个新的环境变量PATH,并将其路径设置为git安装的目录,但这也没有帮助。

我做错了什么?

英文:

I am trying to install go-sql-driver on Windows Vista but I am having problems with GOPATH.

I installed git as suggested and added GOPATH as a new user environment in Windows with path C:/users/A/desktop/go.

I ran go get github.com/go-sql-driver/mysql in the command line but it gives me this error:

C:\>go get github.com/go-sql-driver/mysql
go: missing Git command. See http://golang.org/s/gogetcmd
package github.com/go-sql-driver/mysql: exec: "git": executable file not found in %PATH%

When I go look at http://golang.org/s/gogetcmd it merely says download git. But it is already downloaded in my machine.

I also went ahead and created a new environement variable for PATH and set its path to the directory where git was installed but that did not help either.

What am I doing wrong?

答案1

得分: 4

http://git-scm.com/downloads下载Git的Windows版本。

运行下载的可执行文件,目前是Git-1.8.3-preview20130601.exe,它将启动一个Git安装向导来安装Git。

检查Git安装选项

  • 从Windows命令提示符中运行Git
  • 检出原样,提交Unix风格的行结尾

通过运行以下命令来检查安装情况:

C:\>git --version
git版本1.8.3.msysgit.0
英文:

Download the Windows version of Git from http://git-scm.com/downloads.

Run the downloaded executable file, currently Git-1.8.3-preview20130601.exe, which will start a Git Setup wizard to install Git.

Check Git Setup Options

  • Run Git from the Windows Command Prompt
  • Checkout as-is, commit Unix-style line endings

Check the installation by running:

C:\>git --version
git version 1.8.3.msysgit.0

答案2

得分: 0

确保Git在%PATH%环境变量中,并确保已安装Git。如果您无法在命令提示符中运行git --version,则表示Git二进制目录未列在您的%PATH%中。通过将Git添加到路径中,关闭命令提示符,并在新的命令提示符中运行git --version来解决此问题。如果您仍然遇到问题,则可能存在其他问题。

英文:

Make sure Git is in the %PATH% environment variable and ensure Git is installed. If you cannot run git --version in the command prompt, then the Git binary directory isn't listed in your %PATH%. Fix this by adding Git to the path, close the command prompt, and run git --version in a new command prompt. If you're still having issues, then you might be having other problems.

答案3

得分: 0

在您的Windows PC上安装GIT BASH桌面应用程序。下载链接在这里。安装完成后,打开shell并输入:

go get -u github.com/go-sql-driver/mysql

这将安装Golang的MySQL数据库包的驱动程序

英文:

Install the GIT BASH desktop app in your Windows PC. The download link is here. Once installed, open the shell and type:

go get -u github.com/go-sql-driver/mysql

This will install driver for Golang's MySQL database package

huangapple
  • 本文由 发表于 2013年7月8日 06:37:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/17517085.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定