2

I played around a bit with my Python installations in OS X Mavericks.

I searched for all files which contained "python2.7" and deleted them. Now i want to point to my current Python version, which is 3.3.2.

When i type in python, i am getting this:

python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No such file or directory

My folder for my Python installation looks like this:

enter image description here

There is no Python-Path set in my .bash_profile file.

Where can i change the current Version of Python?

EDIT: Where i got the new version from? sudo pyenv install 3.3.2

EDIT: The result of which python:

enter image description here

6
  • 1
    You've just deleted your default Python installation? It doesn't seem to be a great idea... Where did you get Python 3.3 from? Commented Dec 27, 2013 at 19:02
  • what happens if you type which python? Presumably it's a symbolic link to a now-deleted executable. By the way, in the future, you can have multiple python versions coexisting on the same machine... There is no reason to completely delete the old version. Commented Dec 27, 2013 at 19:02
  • And 'python' not pointing to Python 2.7 can really confuse some scripts. Commented Dec 27, 2013 at 19:04
  • @cubuspl42 i've edited my post: from pyenv. mgilson: i've edited my post. cubuspl42: Why? Commented Dec 27, 2013 at 19:06
  • Can i delete python completely and install it from the ground up? Commented Dec 27, 2013 at 19:08

2 Answers 2

2

I wouldn't delete the built in Python from the computer. There are applications that use Python 2, so deleting it would break them. I installed Python 3 in parallel to python 2.7.

Also not a good idea to point version 2.7 frameworks at version 3 frameworks for the above reasons. It will make for unnecessary confusion and mess that will be likely to cause issues.

Did you check out the configuration section here:

http://docs.python.org/3.3/using/mac.html

Section 4.1.3 mentions needing to changed environment variables to point to your version of Python that you want to be the default.

As well, here's how to create an alias to make Python 3 easy to access:

How to set Python's default version to 3.3 on OS X?

Don't take this the wrong way, but I would try to undo most of what you've done so far, before you get too far ahead of yourself.

Sign up to request clarification or add additional context in comments.

Comments

1

Ok, i found a solution to install Python completely new. I had to use the official installer from the Python-Website.

  1. I've downloaded the intaller and installed Python.
  2. I moved the new installation to the Python-Versions-Folder:

    sudo mv /Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions

  3. Setting the group to wheel :

    sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/2.7

  4. Updating the current link:

    sudo rm /System/Library/Frameworks/Python.framework/Versions/Current

    sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/Current

  5. Removing old copies

    sudo rm /usr/bin/pydoc

    sudo rm /usr/bin/python

    sudo rm /usr/bin/pythonw

    sudo rm /usr/bin/python-config

  6. Creating the new sym-links:

    sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc

    sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python

    sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw /usr/bin/pythonw

    sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config /usr/bin/python-config

[Source]

1 Comment

this was good stuff, sadly it didn't work for me; I'm getting a nasty "The installer could not install the software because there was no software found to install"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.