[python] How to get setuptools and easy_install?

I downloaded the ez_setup code from here: http://peak.telecommunity.com/dist/ez_setup.py and ran it, but i don't think setuptools was properly installed. When i try to open an egg using easy_install i am getting a NameError. Any thoughts?

Here is the specific error:

Traceback (most recent call last):
  File "C:...setup.py", line 223, in <module>
    easy_install eggsetup.py
NameError: name 'easy_install' is not defined

This question is related to python egg

The answer is


For linux versions(ubuntu/linux mint), you can always type this in the command prompt:

sudo apt-get install python-setuptools

this will automatically install eas-_install


For Amazon Linux AMI

yum install -y python-setuptools 

apt-get install python-setuptools python-pip

or

apt-get install python3-setuptools python3-pip

you'd also want to install the python packages...


please try to install the dependencie with pip, run this command:

sudo pip install -U setuptools

On Ubuntu until python-distribute is something newer than 0.7 I'd recommend:

$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python

See http://reinout.vanrees.org/weblog/2013/07/08/new-setuptools-buildout.html


For python3 on Ubuntu

 sudo apt-get install python3-setuptools

If you are installing from distro packages, then this probably doesn't apply to your scenario...

recompile python

I have multiple versions of Python built from source installed, and I found I didn't have setuptools for version 3.5. It seems like I was missing the zlib libraries when I compiled 3.5, which subsequently made the setuptools install fail quietly (to me at least). Recompiling with the zlib libs installed fixed this for me.

install from GitHub

If you are for some reason missing setuptools and have Python compiled with all the necessary libs, you should be able to install it from the GitHub repo like this:

git clone https://github.com/pypa/setuptools.git
cd ./setuptools
python3.5 bootstrap.py
sudo python3.5 setup.py install

Give this link a try --> https://pypi.python.org/pypi/setuptools

I'm assuming you're on Windows (could be wrong) but if you click the green Downloads button, it should take you to a table where you can choose to download a .exe version of setuptools appropriate for your version of Python. All that eggsetup stuff should be taken care of in the executable file.

Let me know if you need more help.