How to install setuptools?

I am trying to install setuptools. When I run "sh setuptools-0.6c9-py2.4.egg", I get the following message:

Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-26338.write-test'

Expected since I do not have root privileges. Some, as I came up with the idea of ​​creating a "virtual" Python.

I download "virtual-python.py" and run it using Python for the entire site. It creates the subdirectories "lib", "bin" and "include" in my home directory. At the end of the output of "virtual-python.py", I see the following message:

Now you are ready to download ez_setup.py and run / home / myname / bin / python ez_setup.py

I download this file and run it. But how do I get the same error message:

Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-925.write-test'

OK I use the "prefix" to force ez_setup.py to write to the local directory:

/home/myname/bin/python ez_setup.py --prefix=~ 

And then I get:

  • You can configure the installation directory to support ".pth" files using one of the approaches described here:

http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations

So, I am redirected to the same page as before. So, I do not know what to do now.

I have another hint:

  • You can add the installation directory to the PYTHONPATH environment variable. (Then it should also be on PYTHONPATH whenever you start Python and want to use the package you install.)

But if I print:

 PYTHONPATH=/home/myname/lib/python2.4/site-packages 

I still get the same result that Python does not see environment variables.

Can anyone please help me with this?

+5
source share
4 answers

Just add more information about what has already been said.

  • Download tar.gz from the latest version of virtualenv .
  • Unzip it.
  • You don't even need to install it, just run virtualenv.py , for example:
    virtualenv-1.3.3/virtualenv.py mypyenv
    mypyenv virtual Python environment will be created in your current directory and will contain easy_install ready to use.
  • Activate it:
    source mypyenv/bin/activate
    or on Windows do:
    mypyenv\Scripts\activate.bat
    Now your PATH is configured to point to Python executables under mypyenv . From this shell session, you can easy_install anything you want, and the resulting things will be installed in the guts of mypyenv instead of your default Python location, thereby eliminating the need for administrator privileges.

OS X Snow Leopard caveat:
For some reason, virtualenv-1.3.3 does not work with embedded Python under /System/Frameworks . I had to create a separate version of Python from the source and install it under /usr/local/python_2_6_2 .
With this, I used the parameter --python /usr/local/python_2_6_2/bin/python with virtualenv.

+8
source

Virtualenv comes preloaded with setuptools, I reckon. I know that it at least comes with easy_install . Then you can run:

 /home/myname/bin/easy_install setuptools 

This should install the latest version of setuptools on your virtual server.

+1
source

You must first activate your virtual server, otherwise you will only have a bunch of folders. Use the full script path in your virtual env bin or do source bin/activate

+1
source

In linux you can run the following command

wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

0
source

Source: https://habr.com/ru/post/914625/


All Articles