2
votes

I'm trying to install an older version of Python on my Mac. I'm currently running 2.7.9, but our production environment is running 2.7.6. (There is a compatibility issue with gevent and 2.7.9.)

I found pyenv which allows me to install various versions. I've installed pyenv with brew and installed 2.7.6. I then created a virtualenv with 2.7.6 with the following command:

mkvirtualenv my_env --python=/Users/dustin/.pyenv/versions/2.7.6/bin/python

It seems to work fine and I'm running Python 2.7.6. The problem I am running into is that I can't install certain packages with pip such as Cython or M2crypto. I get C compile errors.

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command 'clang' failed with exit status 1

If I create a virtualenv without specifying the Python version, these packages install fine. How do I fix this?

1

1 Answers

0
votes

It could be due to trying to run an older version of Python 2.7.x (like 2.7.6) on newer releases of OS X. If you are on OS X 10.10, that's very likely the problem. See http://bugs.python.org/issue21811. You may need to add at least the patch for _osx_support.py. If not, try running pip with -v and update your question with the results.

Update: With the additional information you supplied, it is clear that you are running into the OS X 10.10 support issues that were fixed in the changes for Issue21811 released in 2.7.8. In particular, the configure changes are needed to correctly parse the two-digit minor version number (10); otherwise, the code in configure mistakenly thinks you are are running on a very old version of OS X and generates obsolete link directives. You should backport https://hg.python.org/cpython/rev/2672e30d9095 and https://hg.python.org/cpython/rev/a7ab09e00dbc.