dongxin9759 2014-10-13 18:10
浏览 6
已采纳

为所有用户设置转到路径时出错。

I have installed go and successfully setup it's path. In order to run hello.py I have to run

   sudo go run hello.go 

but I want to run it from

  go run hello.go 

but it doesn't work. I did path setup in .bashrc and .profile do I have to do anything more?

  • 写回答

1条回答 默认 最新

  • drug95107 2014-10-14 05:57
    关注

    Try to do a manual installation, entirely in your $HOME (that way, root is never involved, and you won't have to do any sudo.

    mkdir ~/golang
    cd ~/golang
    wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
    tar -xzf go1.3.1.linux-amd64.tar.gz
    

    Add the following lines to your ~/.bashrc file:

    export GOROOT=$HOME/golang/go 
    export PATH=$PATH:$GOROOT/bin
    export GOPATH=~/golang/yourProjects
    

    Then

    mkdir -p ~/golang/yourProjects/src
    

    And you can start playing with ~/golang/yourProjects/src/hello.go.

    See more about go workspace (the folder referenced by $GOPATH) in "How to Write Go Code".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器