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

I'm having trouble installing python packages using pip in virtualenv. After some research, there seems to be a problem with PyYaml. I downloaded the latest version and tried to create it. There are no problems with using system python. However, when I try to run the same command (installing python setup.py) 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 came from ... Any clue?

+6
source share
2 answers

I came across the same question using pyenv. The dirty way that I got to install used

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

If you use pyenv, you can also use

 CC=$(which python) pip install pyyaml 
+2
source

As discussed in pyenv # 273 , the problem occurs after installing Python <2.7.8 on macOS.

You can fix it yourself:

 $ export p=/Users/andrei/.pyenv/versions/2.7.6 $ sed -i -e "s#python.exe#${p}/bin/python2.7#g" "$p/lib/python2.7/_sysconfigdata.py" 

Example for 2.7.6, replace the version if you need 2.7.7, etc.

If you are not using pyenv , change the path to where Python is stored.

+2
source

Source: https://habr.com/ru/post/975640/


All Articles