public
Created

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). I found surprisingly little help on the web for doing this, so I want to share my solution.

  • Download Gist
install_packages.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# 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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.