Pergunta

So sorry for posting yet another of these types of questions, I've looked extensively and can't find an answer.

I'm a Python nub, and have only a loose grasp of Unix.

I specifically need to develop in Python2.5. I also need access to AppKit. I'd installed Python2.5 via the universal installer along with the libraries I needed. At the time, the default OS install, 2.7, was able to import AppKit. Python2.5, meanwhile, could not. I found this tutorial for replacing the native install of Python, and thought that if I followed it to the letter but for switching out the 2.7 install for 2.5, everything would be swell.

After following the tutorial, my native Python is indeed 2.5. However, AppKit, which continues to be installed where it previously had been working for the native Python, still cannot be imported (ie. "no module named AppKit").

  • Xcode is v.4.6.1 and CL tools are installed
  • from bash, which python returns /usr/bin/python
  • My primary install is at: /System/Library/Frameworks/Python.framework with symbolic links to /Library/Frameworks/Python.framework. The binaries are likewise linked; usr/bin/python (and pythonw, python-config, pydoc) are all symlinked to /usr/local/bin.
  • I've deleted smtpd.py in every location I'd found it
  • I've left easy_install (and easy_install-2.5/6/7) in both /usr/bin and /usr/local/bin because I've never used easy_install and didn't know either way what to do with it.

I'm perfectly aware of how profoundly I've messed everything up. Can anyone please tell me what I need to be doing to get things back in order?

UPDATE: Following the comments below, I did indeed end up re-installing Mountain Lion. Couldn't have been less painless; I had indeed correctly installed AppKit, and as soon as the native Python was reinstalled I was able to work immediately.

Foi útil?

Solução

It seems you've had a difficult day. Let me give you some guidance:

  • It is generally a bad idea to follow random instructions from the internet when they don't specifically give you the instructions to revert to the original state. "Go ahead and rm -rf something from /usr/bin" is a red flag. Experienced admins always move it out of the way, rename it, and know that removing is always a bad idea.
  • Having to run multiple versions of Python and multiple libraries inside each of the versions installed is a standard problem with proven and tested solutions. Don't remove python installations much less the default one. Learn how to use virtualenv-burrito. Learn how to pip install stuff into your virtualenvs. Keep a virtualenv for each project you work on. Learn how to define and keep updated a requirements.txt file for each project you work on.
  • Once you understand all of this (if you don't understand you'll just repeat the same stuff). Now to solve your problem, I would revert to a point 24h ago using time machine, and then move ahead doing things the right way.

Outras dicas

Replacing the default Python is a really really really bad idea ( Remove preinstalled python from Mac OSX 10.8 , For real, too many installations of Python on OSX Mountain Lion )

You should try to rollback your machine by whatever means you can ( carlosdc suggested timemachine - that would be a great option if you have a snapshot ).

You can use virtualenv to create custom environments

You can also use shell scripts and your user's .profile/.bash to specify which Python version should be prioritized.

I had that problem too and fixed it just installing python again, downloading it from the official website

ps: my OS is el capitan

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top