Create a gist now

Instantly share code, notes, and snippets.

Script to easily install PyPi packages into Enthought (or any other Python) environments. Enthought provides a great product, but (probably for their own commercial or other interest) it is not straight forward to install PyPi packages into the Enthought environment (at least not for someone who is accustomed to working in a Linux environment). …
# Using pip is usually more reliable than using easy_install.
# Set USEPIP=False only if pip fails for some reason.
USEPIP = True
packages = [
## Add the packages to be installed here.
## Version numbers can be specified.
## Example:
## 'lxml>=2.0.0',
## 'leaf',
]
if USEPIP:
try:
import pip
except:
from setuptools.command import easy_install
easy_install.main(['pip'])
import pip
args = ['install']
args.extend(packages)
pip.main(args)
else:
from setuptools.command import easy_install
easy_install.main(packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment