Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT:</strong> This answer has been getting voted up recently, and I want to modify it to reflect what I'm doing now.</p> <p>Firstly, I've switched from MacPorts to <a href="http://mxcl.github.com/homebrew/" rel="nofollow noreferrer">Homebrew</a> for package management on Mac OS X. Secondly, I've switched from using my package manager to using <a href="http://www.pip-installer.org/en/latest/index.html" rel="nofollow noreferrer">pip</a> and <a href="http://www.doughellmann.com/projects/virtualenvwrapper/" rel="nofollow noreferrer">virtualenvwrapper</a> to manage my Python libraries.</p> <p><strong>Why I switched:</strong></p> <p>At first, with just a few Django projects, it was very easy to keep everything up to date using MacPorts. It was also fairly easy to have multiple versions of Python using <code>python_select</code>. What I didn't realize was that I was doing a pretty terrible job of keeping multiple libraries working side-by-side. It became obvious as I upgraded my packages that sometimes I <strong>really</strong> didn't want a project's Django version to change. After a couple of Django 1.1 projects (now running Django 1.3) started exhibiting weird behaviour (forms failing to submit because of CSRF middleware changes, small differences in Django libraries, admin app assets changing, and so on) it became clear that I should look into a better solution.</p> <p><strong>What I do now:</strong></p> <p>On Mac OS X I'm moved over to using pip and virtualenvwrapper. First off, I install virtualenvwrapper:</p> <pre><code>pip install virtualenvwrapper </code></pre> <p>This will grab virtualenv and virtualenvwrapper. You then need to add the following to your <code>.bashrc</code> or <code>.profile</code> and <code>source</code> it or open a new shell.</p> <pre><code>export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh # where Homebrew places it export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' # optional </code></pre> <p>Line 1 sets up the variable <code>workon</code> needs to find its files. Line 2 points to the main shell script (the path here is where Homebrew places the file, it might be different if you're using another package manager). Line 3 is optional, but I really like it: it makes sure that no currently installed libraries in the "main" site-packages repository will leak into your newly created virtual environment. I find this keeps things clean and leads to fewer surprises down the road as things are upgraded.</p> <p>The next step is to create a new virtual environment:</p> <pre><code>mkvirtualenv testEnvironmentName </code></pre> <p>After making the environment, you'll be placed into it. If you kept the <code>--no-site-packages</code> flag, you can type <code>pip freeze</code> to see that your Python library slate is now blank. To escape from the virtual environment, use the <code>deactivate</code> command. To get into your virtualenv again, use <code>workon testEnvironmentName</code>. Note that you can use tab completion on the name of the environment. Also note that typing <code>workon</code> by itself will give you a list of available environments. From here you can <code>pip install</code> any libraries you want, including PIL.</p> <p>To learn more about virtualenvwrapper, <a href="http://www.doughellmann.com/docs/virtualenvwrapper/" rel="nofollow noreferrer">I recommend checking out the documentation</a>. </p> <p><a href="http://mathematism.com/2009/07/30/presentation-pip-and-virtualenv/" rel="nofollow noreferrer">Here's another great resource which taught me a lot about using virtualenvwrapper</a> (<a href="http://vimeo.com/5894881" rel="nofollow noreferrer">or just view the screencast</a>)</p> <hr> <p><strong>ORIGINAL:</strong></p> <p>You can also instal PIL using <a href="http://www.macports.org/" rel="nofollow noreferrer">MacPorts</a>. The package name is <code>py-pil</code>. <a href="http://py-pil.darwinports.com/" rel="nofollow noreferrer">Here's more information on the package</a>. I'm pretty fond of MacPorts over pip, as I find it gives me a bit more configurability when it comes to keeping several versions of python and several libraries installed.</p> <p>Here are the installation instructions for MacPorts: <a href="http://www.macports.org/install.php" rel="nofollow noreferrer">http://www.macports.org/install.php</a></p> <p>See also: <a href="https://stackoverflow.com/questions/1213690/what-is-the-most-compatible-way-to-install-python-modules-on-a-mac/1213823#1213823">What is the most compatible way to install python modules on a Mac?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload