Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing setuptools in a private version of python

Tags:

python

A newbie question but.....

I've installed python2.7 on a host where the system version is 2.3 (2.7 at ~/python2.7/bin/python). I'd like to add a few packages such as MySQLdb but need setuptools.

The directions say that you can use --prefix as an argument. However, if I do the following: sh setuptools-0.6c11-py2.7.egg --prefix=~/python2.7/bin/python

I get the error msg: -bash-3.00$ sh setuptools-0.6c11-py2.7.egg --prefix=~/python2.7/bin/python setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found

Am I not using the --prefix command correctly? Naturally, typing sh setuptools-0.6c11-py2.7.egg --help can't find python either.

How do I tell setuptools where to find python explicitly? Any other issues I need to be aware of?

like image 489
timpone Avatar asked Aug 02 '10 18:08

timpone


People also ask

How do I import setuptools in Python?

Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.

How do I install setuptools a specific version?

To use a specific version of setuptools it is necessary to have it in both locations - in pyproject. toml and at the beginning of install_requires of setup.py. The tool like pip will use the version from pyproject. toml to build the project.

Is setuptools included in Python?

Setuptools is a package development process library designed to facilitate packaging Python projects by enhancing the Python standard library distutils (distribution utilities). It includes: Python package and module definitions.


1 Answers

I'm an old-fashioned guy and I avoid using eggs, I usually download the source code tarball, extract it and use setup.py

When dealing with multiple python versions, I usually call the required one explicitly, like this:

$ /usr/bin/python2.6 setup.py build
$ sudo /usr/bin/python2.6 setup.py install

There is also a way to do a preliminary "chroot" when installing:

$ python setup.py install --root /tmp

This is useful when you want a temporary install into a certain directory, which later gets used to build a distro-specific package.

This workflow always serves me well.

like image 180
jedi_coder Avatar answered Sep 21 '22 07:09

jedi_coder