Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup PyYaml with pyenv on Mac OS X; file not found: python.exe

Tags:

python

I'm having trouble installing python packets using pip in a virtualenv. After some investigations, it turns out there seems to be a problem with PyYaml. I downloaded the last version and tried to build it. When using the "system" python, there is no problem. However, when I try to run the same command (python setup.py install) after activating my virtualenv, I get the following error:

gcc -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -    L/Users/a/.pyenv/versions/2.7.7/lib build/temp.macosx-10.10-x86_64-2.7/ext/_yaml.o -lyaml -o     build/lib.macosx-10.10-x86_64-2.7/_yaml.so
ld: file not found: python.exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1

I have no idea where it comes from... Any clue?

like image 555
Antoine M. Avatar asked Sep 22 '14 09:09

Antoine M.


People also ask

Where does Pyenv pip install packages?

More precisely, it installs packages into an existing Python installation, for example in /usr/lib/python3/dist-packages/ . If pip is run inside a pyenv environment, it will install the packages into the currently enabled Python environment, somewhere under $PYENV_ROOT .


1 Answers

I ran into the same issue using pyenv. The dirty way I got it to install was using

CC=/path/to/virtualenv_dir/bin/python2.7 /path/to/virtualenv_dir/bin/pip install pyyaml

If you're using pyenv you can also use

CC=$(which python) pip install pyyaml
like image 73
lew Avatar answered Oct 30 '22 23:10

lew