简体   繁体   中英

Error installing glpk package "Could not build wheels for glpk which use PEP 517 and cannot be installed directly" on Macbook

I'm practicing for a linear programming/optimization course I'll be taking in the fall.

Most of the course uses jupyter and part of the course requires me to install a package called 'glpk.' I'd like to install it on my mac since anaconda normally makes things like this a breeze, but so far everything I've tried has not worked.

I've tried:

sudo apt install libglpk-dev python3.8-dev libgmp3-dev

sudo pip3 install glpk --no-binary :all: 

pip install --upgrade pip setuptools wheel

pip install glpk --no-cache-dir

pip --verbose install glpk

All of these have run into their own troubleshooting problems or have had no effect.

I'll happily listen to any advice or suggestions anyone has to offer, Thank you.

This answer assumes you have homebrew installed .

brew install glpk

# set C linker and include flags so that the pip wheel build can
# find the headers and library

LDFLAGS="-L$(brew --prefix glpk)/lib" CFLAGS="-I$(brew --prefix glpk)/include" pip install glpk

This should allow the glpk module to build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM