Error installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'
I am trying to install settuptools on a Linux machine, I do not have root access. I am already creating a virtual python.
dgomez:~/download> which python
/home/dgomez/bin/python
when i do the following i get an error:
/home/dgomez/bin/python ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8816.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
I would like to know how to fix this. I see in another forum where the user has fixed it by creating a directory, but in my case I don't have root access, I cannot create a directory. Thanks to
UPDATE
I started python
ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages/
Boo the error still appears:
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/dgomez/lib/python2.7/site-packages/
and your PYTHONPATH environment variable currently contains:
''
source to share
The error message tells you exactly what to do, use the --install-dir
or option --prefix
to install the package on your virtual Python installation instead of the default location.
It might look something like this:
/home/dgomez/bin/python ez_setup.py --prefix=/home/dgomez
Or with --install-dir
:
/home/dgomez/bin/python ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages
Note that you may need to change the directories used in the options above, depending on the actual location of your Python installation's package-site directory.
edit: To fix the new error you see you need to add this directory to your environment variable PYTHONPATH
, you can do it with the following command:
export PYTHONPATH=$PYTHONPATH:/home/dgomez/lib/python2.7/site-packages/
If you're using bash on a Mac or GNU / Linux distribution, you can add this line to your ~/.bashrc
file so you don't have to manually start it.
source to share
I met the same problem. Somehow this directory got deleted so I didn't have pip and setuptools. The way I solved it was to download pip directly from the pip website . I solved it by downloading the pip file from get-pip.py . Once downloaded, just run this file in your direction in python, you can use this setuptools again.
source to share