Created
January 10, 2013 02:06
-
-
Save ChrisBeaumont/4498773 to your computer and use it in GitHub Desktop.
Workaround linker issue when installing scikit-learn on a mac that uses macports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_call | |
#remove build directory | |
check_call('rm -rf build'.split()) | |
#compile and capture stdout | |
with open('build.log', 'w') as log: | |
check_call('python setup.py install --user'.split(), stdout=log) | |
log = open('build.log').read().splitlines() | |
#find all linker commands that used -L/opt/local/lib | |
bad_cmds = filter(lambda x: '-L/opt/local/lib' in x, log) | |
#strip out this part, and re-run | |
for cmd in bad_cmds: | |
cmd2 = cmd.replace('-L/opt/local/lib', '') | |
print cmd2 | |
check_call(cmd2.split()) | |
check_call('python setup.py install --user'.split()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment