chiennifer
chiennifer

Reputation: 155

Unable to install Python build with shared library using pyenv on MacOS 11.1

I am running into an error when using trying to install Python 3.8.6 with a shared library enabled. I am using PyEnv 1.2.23 on an M1 Macbook Pro.

In particular, running:

$ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.6

returns the error message:

python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/python-build.20210309124942.97911
Results logged to /var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/python-build.20210309124942.97911.log

Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found. Stop.

I've also tried:

$ arch -x86_64 env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.6

and I get the same output.

I have also tried this:

$ brew install zlib
$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include

and alas, no avail.

any ideas? thanks~

Upvotes: 6

Views: 2225

Answers (1)

Tim Roberts
Tim Roberts

Reputation: 54777

M1 support wasn't added to Python until 3.9.1. You'll need to upgrade.

Upvotes: 4

Related Questions