Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Local installation problem #28

Open
pbandyop opened this issue Sep 23, 2015 · 10 comments
Open

Local installation problem #28

pbandyop opened this issue Sep 23, 2015 · 10 comments

Comments

@pbandyop
Copy link

Hi,

this project is based on Python 2.7 version but I need it for Python 2.7.5. So I changed the cgo file to Python 2.7.5 version by downloading the project locally in my computer. So, I can't use the command go get ... to install it. I need to install it locally in my computer use the make file. Now, I am getting this error:

go get -compiler="gc" .
go install: no install location for directory /Users/../../go-python-master outside GOPATH
make: *** [install] Error 1

I tried to set the GOPATH with: export GOPATH=${PWD} but in vain. Could you tell the right way to install it locally.

@sbinet
Copy link
Owner

sbinet commented Sep 23, 2015

sure, here it is:

$ export GOPATH=$HOME/development/go
$ mkdir -p $GOPATH/src
$ cd $GOPATH/src
$ git clone git://github.com/sbinet/go-python github.com/sbinet/go-python
$ cd github.com/sbinet/go-python
$ make install

that said, even on OSX, a properly installed python-2.7.x (with the proper pkgconfig support file(s)) should be usable with a simple #cgo pkgconfig: python-2.7 line.

how did you install this python-2.7.5 version?

what does this print?

$ pkg-config --list-all | grep python
python2                     Python - Python library
python3                     Python - Python library
python-2.7                  Python - Python library
python-3.4                  Python - Python library
python-3.4m                 Python - Python library

$ python2 --version
Python 2.7.10

@pbandyop
Copy link
Author

Hi I tried the installation as recommend by you but without changing the cgo file, I get the following error:

`$ make install
go get -compiler="gc" .
warning: GOPATH set to GOROOT (/Users/pbandyop/Documents/HIIT/Mohammad_Internship/go) has no effect

pkg-config --cflags python-2.7

Package python-2.7 was not found in the pkg-config search path.
Perhaps you should add the directory containing python-2.7.pc' to the PKG_CONFIG_PATH environment variable No package 'python-2.7' found pkg-config: exit status 1 make: *** [install] Error 2

So, I changed the cgo file to python-2.7.5, then I get the following error:
`go get -compiler="gc" .
warning: GOPATH set to GOROOT (/Users/pbandyop/Documents/HIIT/Mohammad_Internship/go) has no effect

pkg-config --cflags python-2.7.5

Package python-2.7.5 was not found in the pkg-config search path.
Perhaps you should add the directory containing python-2.7.5.pc' to the PKG_CONFIG_PATH environment variable No package 'python-2.7.5' found pkg-config: exit status 1 make: *** [install] Error 2

I get no results with $ pkg-config --list-all | grep python. If I do $ python --version then I get Python 2.7.5.

@sbinet
Copy link
Owner

sbinet commented Sep 28, 2015

A couple of things:

As the go tool for you don't put GOPATH in the same place than GOROOT.
they might be sibling directories. But they shouldn't be the same directory.

How did you install python?
What platform are you using? Mac OSX I surmise...

(Sorry... I am at a conference this week with limited connectivity...)

@sbinet
Copy link
Owner

sbinet commented Sep 28, 2015

(Ie: I haven't a Mac machine at ready until next week...)

@pbandyop
Copy link
Author

Yes it is Mac OS. I installed Python through brew. I have changed the GOROOT but still getting same error.

@wangyanglong
Copy link

i just fix the problem in my mac:
assume you already install python(my is python2.7.5)
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
and add file python2.7.pc in /usr/lib/pkgconfig
here is the content:
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Python
Description: Python library
Requires:
Version: 2.7
Libs.private: -lpthread -ldl -lutil
Libs: -L${libdir} -lpython2.7
Cflags: -I${includedir}/python2.7

@klokare
Copy link

klokare commented Jan 10, 2017

I was able to fix this for my MacOS Sierra install by adding the following to my PKG_CONFIG_PATH:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig

@hb1001
Copy link

hb1001 commented May 26, 2020

I can run this package successful. My version of Python is 2.7.15. And the OS is ubuntu

@wenhaoZhao1997
Copy link

I was able to fix this for my MacOS Sierra install by adding the following to my PKG_CONFIG_PATH:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig

mac os arm64 , it did work

@alistair-mclean
Copy link

I was able to fix this for my MacOS Sierra install by adding the following to my PKG_CONFIG_PATH:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig

This solution worked on macOS Catalina 10.15.7 w/ intel processors.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants