LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-14-2009, 05:35 AM   #1
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,475

Rep: Reputation: 87
Python 2.6 - cannot figure out how to get it to find its own library files


Hi Guys

I've compiled and installed Python 2.6 using the following configure line:

Code:
[rylan@development Python-2.6.3]$ ./configure --enable-pth --enable-shared
Python compiles and installs fine afterward. I've confirmed that the files go into /usr/local/lib and /usr/local/bin:

Code:
[root@development bin]# ls python* -l
-rwxr-xr-x 2 root root 7767 Oct 14 12:11 python
-rwxr-xr-x 2 root root 7767 Oct 14 12:11 python2.6
-rwxr-xr-x 1 root root 1424 Oct 14 12:12 python2.6-config
lrwxrwxrwx 1 root root   16 Oct 14 12:12 python-config -> python2.6-config
[root@development bin]#  cd /usr/loca/lib/python2.6/
[root@development python2.6]# pwd
/usr/local/lib/python2.6
[root@development python2.6]#
I've symlinked /usr/lib/python2.6 to /usr/local/lib/python2.6:

Code:
[root@development lib]# ln -s /usr/local/lib/python2.6/ python2.6
[root@development lib]# ls python2.6 -l
lrwxrwxrwx 1 root root 25 Oct 14 12:26 python2.6 -> /usr/local/lib/python2.6/
[root@development lib]#
Furthermore, I've ensured that PYTHONPATH and PYTHONHOME are set correctly in my .bashrc:

Code:
export PYTHONPATH=usr/local/lib/python2.6
export PYTHONHOME=usr/local/lib/python2.6

[rylan@development ~]$ set | grep PYTHON
PYTHONHOME=usr/local/lib/python2.6
PYTHONPATH=usr/local/lib/python2.6
[rylan@development ~]$
HOWEVER

Python still does not find its files:

Code:
[rylan@development ~]$ python
'import site' failed; use -v for traceback
Python 2.6.3 (r263, Oct 14 2009, 12:08:21)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
I. e.
Quote:
'import site' failed; use -v for traceback
keeps on occurring. I've reinstalled twice, removed the .bashrc entries, nothing at all helps. I just keep on getting "import site failed" messages.

Also, this of course means I cannot run any worthwhile python scripts. I'm trying to get scons going, but of course it won't work 'cause python cannot find "itself":

Code:
[rylan@development scons-1.2.0]$ python setup.py install
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    import os
ImportError: No module named os
[rylan@development scons-1.2.0]$
How can I get python 2.6 to "find itself" on my system? I'm running FC6. (This doesn't work on my FC11 system at home either, with exactly the same problems.)

ANY help appreciated!

Thanks,

Last edited by rylan76; 10-14-2009 at 05:45 AM.
 
Old 10-14-2009, 12:00 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Python is not my thing, but it is installed on my system (I just used my distro's package manager to install it) and it works.

You keep getting the error notification "'import site' failed; use -v for traceback"

So why haven't you tried python -v ? Maybe that'll help you find whatever is missing, otherwise post the output here and some python guru will probably appear.
 
Old 10-14-2009, 04:38 PM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by rylan76 View Post
Hi Guys

I've compiled and installed Python 2.6 using the following configure line:


[ snip ]

I've reinstalled twice, removed the .bashrc entries, nothing at all helps. I just keep on getting "import site failed" messages.

Also, this of course means I cannot run any worthwhile python scripts. I'm trying to get scons going, but of course it won't work 'cause python cannot find "itself":

[ snip ]

ANY help appreciated!

Thanks,
Here is a recipe to solve the problem:

1. Run the machine that has Fedora 11, just because you can use yum and can reasonably expect up-to-date archive content.

2. Install Python properly:

# yum install python

Suddenly everything will work, without any special variable settings or library manipulation. Experience shock and disorientation.

3. Scratch you head, ruminate, walk around in circles.

4. Decide to upgrade to Fedora 11 on both machines.

Done.
 
Old 10-16-2009, 01:22 AM   #4
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,475

Original Poster
Rep: Reputation: 87
Tee hee hee fanx.... yep I was coming to that conclusion myself (and it does, in fact, work fine on FC 11 anyway - after ensuring the paths were correctly setup...!)

Seems I -did- have an older python on the FC6 machine at work, and it has somehow messed up the new Python install.

Anyway, will try it out this afternoon at home on FC11.

Thanks for the replies!

Last edited by rylan76; 10-16-2009 at 01:23 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
install from source - unable to find the libcurl library - but library is installed pulper Linux - Newbie 2 02-23-2009 09:00 PM
[help]---Can't find Python library python2.5 LinczO_Dz Linux - Software 6 04-19-2008 10:09 AM
Compiling library files into another library file. knobby67 Programming 3 04-10-2007 02:07 PM
How to find needed library files sporty Linux - Software 9 04-12-2006 03:23 PM
compile..can't find library files doublefailure Linux - General 3 12-03-2002 02:11 AM


All times are GMT -5. The time now is 03:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration