I vaguely remember some sort of setuptools wrapper that would generate .egg files from distutils source. Can someone jog my memory?
Asked
Active
Viewed 1.7k times
2 Answers
25
setuptools monkey-patches some parts of distutils when it is imported. When you use easy_install to get a distutils-based project from PyPI, it will create an egg (pip may do that too). To do the same thing locally (i.e. in a directory that’s a code checkout or an unpacked tarball), use this trick: python -c "import setuptools; execfile('setup.py')" bdist_egg
.

merwok
- 6,779
- 1
- 28
- 42
-
1Exactly what I was looking for. Hopefully I won't have this hard a time finding it the next time I need it. Thanks. – Ben Apr 02 '12 at 03:57
-
3In Python 3, `execfile` disappeared, so you'll want something like `python -c "import setuptools; exec(open('setup.py').read())" bdist_egg`. – Xiong Chiamiov Feb 26 '16 at 23:49
23
Have you tried
python setup.py bdist_egg
Here I assume you are using setuptools instead of distutils i.e.
in setup.py instead of
from distutils.core import setup
use
from setuptools import setup

Anurag Uniyal
- 85,954
- 40
- 175
- 219
-
1Thanks, but looking for something that would turn someone else's distutils package into an egg. It does exist, as I found it before. – Ben Mar 30 '12 at 21:37
-
2