fogleman / primitive

Reproducing images with geometric primitives.
https://primitive.lol/
MIT License
12.35k stars 608 forks source link

I have downloaded the package ,how can I run it ? #22

Closed lchreal6 closed 7 years ago

lchreal6 commented 7 years ago

In the seconde step ,I input the line "primitive -i 1.jpg -o 1.jpg n-100",but show that "bash: primitive: command not found" ?How to run it ? I am a green hand ,thanks.

mrbarletta commented 7 years ago

Maybe you need to set the GOPATH + PATH in your system but you still can use it using the absolute path to the primitive binary file

~/gocode/bin/primitive -i 1.jpg -o 1.jpg -n 100
bmaltais commented 7 years ago

Did you install golang? Did you install primitive with:

go get -u github.com/fogleman/primitive

Make sure to add the go path to your .bashrc file:

# Add go
export PATH=$PATH:/usr/local/go/bin:/home/bernard/gosrc/bin
export GOPATH=$HOME/gosrc

Bernard

fogleman commented 7 years ago

You might also want to put $GOPATH/bin on your $PATH.

duhaime commented 7 years ago

In case other OSX users land here wanting to run this package from the command line, I got going by installing go, then adding the following to my bash profile:

######
# GO #
######

export GOPATH=/Users/YOUR-USERNAME-HERE/go
export PATH=$GOPATH/bin:$PATH

I then ran source ~/.bash_profile, and reinstalled the package go get -u github.com/fogleman/primitive. Typing which primitive then gave a response...

DePasqualeOrg commented 6 years ago

@duhaime's solution will install in your home directory. If you don't want to do that, I recommend the following solution for macOS:

Run brew install go

Add the following lines to your .bash_profile:

# Go
export GOPATH=/usr/local/opt/go
export PATH=$GOPATH/bin:$PATH

Run source ~/.bash_profile to reload your profile.

Then install primitive with go get -u github.com/fogleman/primitive