David Waterworth
David Waterworth

Reputation: 2931

Generate python3-config for pyenv + virtualenv

I'm trying to compile a library which takes the path to python3-config as one of it's arguments i.e. -DPYTHON_CONFIG=python3-config then sets various compiler flags based on it's contents. This file exists on my machine for python 3.6 as that's the system version, but I'm trying to build the library using a python 3.7.1 pyenv+virtualenv so I need to generate a corresponding python3-config for each specific python environment. How can I do this? All I've found so far is this file is generated by sudo apt-get install python-dev

Edit: I've discovered that pyenv python3-config exists in /home/david/.pyenv/shims/python/python3-config but this version is much smaller than the version from /usr/bin/python3-config

Upvotes: 2

Views: 4454

Answers (1)

David Waterworth
David Waterworth

Reputation: 2931

I figured it out myself

Assuming pyenv is installed in the recommended way, and python 3.7.1 is installed using pyenv then the paths to the required bin and config are:

~/.pyenv/versions/3.7.1/bin/python3.7

~/.pyenv/versions/3.7.1/bin/python3.7-config

python3.7-config is a script which takes arguments like --includes and returns the info the build system requires to build and link the python extension for the specified pyenv, i.e.

$ ~/.pyenv/versions/3.7.1/bin/python3.7-config --includes

-I/home/david/.pyenv/versions/3.7.1/include/python3.7m

Upvotes: 1

Related Questions