Common sense advice on managing OSX python packages for beginners

If I study python development on OSX (Snow Leopard), what is the best way to manage my python packages?

I am very happy with a lot of great python packages. I would like to start studying them, but package management completely confused me. Obviously, I have no idea what I'm doing. I see a lot of stack overflow questions that address package management, and people often answer them saying, “Why don't you just use x? See how easy it is in this single line that I copied from my shell”,

$ x install something

This is a great answer until x can handle certain dependencies or can handle package y. Here is what I have already done:

  • I started just installing things with easy_install .
  • I soon discovered that some important packages were missing dependencies (PILs), so I hunted and discovered MacPorts .
  • I started using MacPorts and all of my environment variables were really confused, so I learned bash enough to reconfigure PATH, PYTHONPATHand sys.pathto make everything work (and make my terminal window nice). MacPorts seemed great for a while.
  • But then I got confused in which version of the various modules I used, and I found more dependency problems (GDAL) ...
  • Then, some very smart people are strongly encouraged to switch to Homebrew . So I uninstalled MacPorts and installed Homebrew.
  • , Homebrew, , , Formula python, . pypi, , Homebrew , easy_install Homebrew. , . , - ? portfiles ?

, , . , :

  • python
    • appscript
    • PIL
    • Pygame
  • python
    • GDAL
    • PostGIS
    • SciPy
  • -
    • Google-

, . virtualenv , . Homebrew, . , , ( python)?

+5
3

, python - Python- Python, . , , - .

:

OS X Macports . , , , . ( Linux Python /opt/pythonxx/, /opt/python25/,/opt/python26/,/opt/python27 /opt/python 31.)

- Pythons, virtualenv, distribute pip, . , virtualenv python:

$ cd /home/projects
$ /opt/python27/bin/virtualenv acoolproject
$ cd acoolproject
$ ./bin/pip install ThepackageIneed.

, , .

virtualenv, , , , python:

$ ./bin/python main.py

$ /home7projects/acoolproject/bin/python

, , Plone nginx , zc.buildout , zc.buildout , .

+3

If you use Homebrew, you probably want to use pipPython to install packages. pipcan be installed via Homebrew, but Homebrew does not include formulas for other Python packages. But pretty easy to install packages with pip - as simple as

$ pip install <package>

(The package name can be found in PyPI.) If you installed pip through Homebrew, that’s all you need to do.

0
source

All Articles