Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Setuptools with root - Getting a PythonPath error

I already did the virtual python enviroment. When I'm trying to install setuptools I get the following:

 python setup.py install --prefix=/home/dgomez/

Error:

TEST FAILED: /home/dgomez//lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

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:

    ''

When I check the system path, I received the following output:

>>> import sys
>>> import sys

/usr/lib/python27.zip
/usr/lib64/python2.7
/usr/lib64/python2.7/plat-linux2
/usr/lib64/python2.7/lib-tk
/usr/lib64/python2.7/lib-old
/usr/lib64/python2.7/lib-dynload
/usr/lib64/python2.7/site-packages
/usr/local/lib64/python2.7/site-packages
/usr/local/lib/python2.7/site-packages
/usr/lib64/python2.7/site-packages/gst-0.10
/usr/lib64/python2.7/site-packages/gtk-2.0
/usr/lib/python2.7/site-packages

How can I fix this issue?

UPDATE

I fix this issue by edit the .bashrc and I add the following line:

PYTHONPATH="${PYTHONPATH}:/home/dgomez/lib/python2.7/site-packages/"
export PYTHONPATH 
like image 264
amb1s1 Avatar asked Feb 20 '13 15:02

amb1s1


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.


2 Answers

@amb1s1

Environment variables are shortcuts that your system uses to give many programs the ability to find certain shared resources easily. In the Linux environments, these variables are set up for you when you log in to your terminal.

You can solve this problem by typing this code in terminal

export PYTHONPATH="/home/dgomez/lib/python2.7/site-packages"

For permanent fix, you can add these environment variables to “.bashrc” or “.bash_profile“ by just adding the above code in it. Everytime you open a new terminal or login remotely to server, these files are executed & hence all environment variables are made available then and there.

like image 180
flyankur Avatar answered Sep 26 '22 05:09

flyankur


Try putting /home/dgomez/lib/python2.7/site-packages in your PYTHONPATH environment variable.

like image 24
aknuds1 Avatar answered Sep 26 '22 05:09

aknuds1