LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-13-2014, 09:31 PM   #1
steves504
LQ Newbie
 
Registered: Dec 2013
Posts: 6

Rep: Reputation: Disabled
Question How can I make Python2.7 my default Python without deleting/removing python2.6.


I currently have Redhat6.5_64bit installed, which i have the latest version of Python 2.6 installed. I installed Python 2.7 and I am trying to install a program that takes require "argparse" module to start install. The problems I encounter are:

1. it cannot see python2.7 when the install starts, and gives me a message that i need to install python2.7, but it is already installed. The problem is because it is getting "argparse" from /usr/bin/python2.6 but I want it to automatically get it from /usr/local/bin/python2.7.

2. Second issue is, even with python2.7 installed, I still cannot get all my "pip-packages" installed automatically. Especially pyopenssl, rpyc, web.py, ....

I have tried the symlink, which worked when I entered $python -V
even when I entered
$/usr/local/bin/python2.7
>>import argparse
>>
but when I try to install the program, it still says that it cannot locate the module argparse,and my currenty version of python is still python2.6.

Im lost.
 
Old 03-13-2014, 10:39 PM   #2
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
The "real" answer to having multiple pythons installed on your system is virtualenv:
https://pypi.python.org/pypi/virtualenv

That's probably how you should fix this problem. But maybe it's not what you want, so:

If you've made python2.7 the default for when you execute 'python' then that is calling python2.7 but the system is still pointing to the default libraries that the original python installed came with.

In .bashrc or .bash_profile put in this:

PYTHONPATH=/usr/lib/python2.7/site-packages/:/usr/lib/python2.6/site-packages/
(and so on; it depends on what you want in your python path)

now if you execute 'python' (assuming it's still linked to /usr/local/bin/python2.7) the FIRST place it will look is /usr/lib/python2.7/blah instead of 2.6
 
1 members found this post helpful.
Old 03-21-2014, 11:57 AM   #3
steves504
LQ Newbie
 
Registered: Dec 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
notKlaatu

Thank you for that response, and yes, I did change the Path to get what I was interested in. Thank you again.
 
  


Reply



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
[SOLVED] Trying to install 'Gmail Backup' but it requires python2.5 - I have python2.8... Robert.Thompson Slackware 6 05-10-2011 08:23 AM
Installing python-numpy in the python2.5 installation of eee-pc zoopside Linux - Software 3 04-01-2009 07:42 PM
[help]---Can't find Python library python2.5 LinczO_Dz Linux - Software 6 04-19-2008 10:09 AM
Python2.5-devel is unable to find installed Python2.5 Setya SUSE / openSUSE 1 06-08-2007 01:35 AM
'make' error while installing Python2.3.4 ! Kanaflloric Linux - Software 3 07-29-2004 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:01 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration