I am running Python 2.4 on Redhat Linux 5.
Any idea how to upgrade to either Python 2.6 or 3.0?
Thanks in advance,
Sum
See before upgrading version is 2.x
python --version
Python 2.7.5
Use below command to upgrade your python to 3.x version-
yum install python3x
replace x with the version number you want.
i.e. for installing python 3.6 execute
yum install python36
After that if you want to set this python for your default version then in bashrc file add
vi ~/.bashrc
alias python='python3.6'
execute bash command to apply the settings
bash
Now you can see the version below
python --version
Python 3.6.3
As with all software on Linux, the first port of call should be the package manager, using it will give you a relatively painless experience most of the time.
In the case of Red Hat, that is yum, so you probably want something like:
yum update python
If there is not a package for the software at hand, then you could download the source code and build it, but note that this is generally a harder route - firstly it's more work, and secondly package maintainers are careful to ensure that software functions correctly on a distro, so they are more likely to work well and interact well with the rest of your system.
It's worth noting that you can have 2.x and 3.x installed side-by-side, and most distros package them separately. As such, to get 3.x, you probably want to do:
yum install python3
(Note I don't use Red Hat, so I don't know for sure that is the correct package name).
As a final point - 2.4, 2.6 and 3.0 are all outdated versions. You really want Python 2.7.2 (the latest 2.x release) or Python 3.3 (the latest 3.x release).
Related
I installed Python3.5 in Linux machine using configure, make, make install and made it default over existing Python2.6 . Now I want to uninstall Python 3.5 as it is not supporting zlib. How do I uninstall default Python 3.5. Linux is RHEL6.7.
you probably can remove the directory that contain the new installation.
but the main thing is to remove it from the $PATH.
To re-add Python 3.x, go here to use a software collection which installs "along side" the original 2.6 - so no collisions/corruption. http://developers.redhat.com/products/softwarecollections/get-started-rhel6-python/
This is for 3.4, but you can use these instructions for 3.5 too.
Because python is integral into the RHEL OS, please explain what you mean by:
"and made it default over existing Python2.6 ." Otherwise attempts to "uninstall" your working python install might leave you with a broken RHEL install.
I am not familiar with the linux system and I have already uninstalled Ubuntu 15.04 for 5 times due to improper operation. Please forgive it if my question is some kindly stupid or too easy for you because I really do not want to uninstall Ubuntu again.
There are few question I really need to make clear.
1) On Ubuntu 15.04, the default python is 2.7.9. Now I need to use jupyter notebook so that I choose to install Anaconda. The latest version of anaconda is for python 2.7.11. So do I need to update my default python version to 2.7.11 so that I can use jupyter notebook rightly? Because after I installed the Anaconda for python 2.7.11, the jupyter notebook could not new a python2 script. Hence should I turn to the Anaconda for python 2.7.9?
2) Questions about how to update the python version of Ubuntu exist a lot but I need to make sure what is the rightest and newest one because python is changing everyday.
In this stackoverflow question The Python 2.7 on Ubuntu, this method is recommended the most.
$ python -V
Python 2.6.6
$ curl -kL https://raw.github.com/utahta/pythonbrew/master/pythonbrew- install | bash
$ . $HOME/.pythonbrew/etc/bashrc
$ pythonbrew install 2.7.1
$ pythonbrew switch 2.7.1
Switched to Python-2.7.1
$ python -V
Python 2.7.1
But I saw the comment "should probably use pyenv instead of pythonbrew". So, if I need to work on multi-python environment, is pyenv the newest and most recommended one?
3) If I want to choose the easiest method so that I could use jupyter notebook rightly, is the anaconda for python 2.7.9 the most recommended choice?
Thank you all a lot!
If I understand you right, what are you trying to do is to update Ubuntu's system package.
What I did in the past is I have downloaded newest python, compiled it on my own and then started virtualenv that was using this freshly compiled python. However this process is a bit cumbersome and error prone.
I checked pyenv and pyenv-virtualenv, I think you should try it ( especially later one).
However perhaps Anacodna will work with python 2.7.9 and there is no need to update anything? In general difference between version 2.7.11 and 2.7.9 should be very minor.
My Mac (which I am just starting to use for a development machine to stretch my wings a little from the Windows world) has 2 system-installed versions of Python (python25-apple and python26-apple) as well as 2.7 which I installed and want to use.
I have successfully run port select python python27 and when I list the versions, python27 shows as active and when I run python --version I get 2.7.3.
I'm now trying to install oauth2 using either easy_install or pip. Having run the appropriately labeled setuptools.egg file: setuptools-0.6c11-py2.7.egg (for example as noted at https://stackoverflow.com/a/5792150/8151) in my shell, I expected to have easy_install point at the correct python version, but when I run either easy_install pip -n or easy_install oauth2 -n`, both are using the 2.6 versions of the file, for for some reason the setup tools does not seem to have updated easy_install to the 2.7 version. Or at least that's what I think seems to be wrong. In addition, there's now an easy_install-2.6 in my path, so it would seem as though easy_install is pointed at the correct version, but it still always tried to install the 2.6 versions of pip or oauth2.
Did I miss a step in here somewhere, or is there another way to do what I need to do?
EDIT
I should probably note that I installed python from MacPorts.
The best way to be sure is to use the specific commands for the version you want, e.g: easy_install-2.7, pip-2.7, etc...
I want to uninstall python 2.6.5, and install python 2.7.3
but there is so many other software relay on it.
so how can I up upgrade python in ubuntu10.04?
I used this link to do the same(i.e the installation part), after doing this the default python version will change to 2.7.3.
Another useful link How do I install python 2.7.2 on 10.04?.
Why do you want to uninstall the old one? You can install python 2.7 and just create a virtualenv that points to it: Use different Python version with virtualenv
Aside from that, it's rather risky to upgrade it, if you don't want to upgrade the whole system.
Over the past couple of months I've set about using Wing IDE to do the vast majority of my programming. I chose Wing primarily because it works well with wxPython, allowing me to debug much more quickly than was the case when I was using TextWrangler alongside Terminal. A quirk of Wing however is that there is no satisfactory way to force universal builds of python to run in 32-bit mode. Since I'm using wxPython 2.8.x (32-bit only) I'm using a 32-bit-only version of python as the executable (2.7.1). So long as I'm only using the python standard library and wxPython I have no problems, my trouble begins when I start trying to install third-party modules to work with this 32-bit version of Python. I want to do all my installing using macports, but it appears that the macports I have downloaded installs modules for use only with a different version of python that happens to be universal. Essentially then this is a question about macports, and I'd appreciate clarification on the following two points:
If I want three versions of python on my computer (say 2.6, 2.7 and 3.2), and want to use macports to install modules for each of them, do I need three separate versions of macports - one for each python?
If I'm right about (1) how do I set about installing separate versions? I've looked on the macports website but can find no reference to alternative versions based on which version of python you want to use it with
Help much appreciated.
A Python installed at /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 almost certainly has nothing to do with MacPorts. You probably installed it from a python.org installer. If you want to install packages to it, you should install separate versions of easy_install using the Distribute package and/or pip for it and directly install packages for that Python instance with them. Those versions will be installed in the framework bin directory, /Library/Frameworks/Python.framework/Versions/2.7/bin. You can't manage Python packages for it from MacPorts; that works only for MacPorts Pythons, i.e. at /opt/local/bin.
So it appears you have three versions of Python 2.7 installed. The Apple-supplied system Python at /usr/bin/python2.7, a MacPorts-installed version at /opt/local/bin/python2.7, and a third (possibly from python.org) at /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 (for which there is likely a symlink at /usr/local/bin/python2.7). There's nothing inherently wrong about having all three installed and the three can easily co-exist. Just keep in mind which one you are using, either by managing your shell path or using an absolute path to each, and that any additional packages installed need to be installed to the correct Python's site-packages directory. If you use easy_install or pip, you need to install and/or use the correct one for each.
If your goal is just to use wx-python with Python 2.7, there is an outstanding MacPorts issue about building a 32-bit-only version of wx-python because of its dependency on deprecated OS X Carbon APIs. There appears to be a new MacPorts port of a Cocoa version of wxWidgets which should work in 64-bit mode. You might want to experiment with it:
sudo port selfupdate
sudo port install py27-wxpython-devel
No you don't need separate versions of macport, what you need is separate versions of python.
Clear steps to do it :
Install macports. You should be able to use port command after that. You should have /opt/local/bin first in your path automatically, if you are using the installer for Mac.
Install python 2.6 - sudo port install python26
Install python 2.7 - sudo port install python27
You can use python26 through /opt/local/bin/python2.6
You can use python27 through /opt/local/bin/python2.7
If you want to use the python27 as default then do a sudo port python-select python27. This will ensure that /opt/local/bin/python is linked to /opt/local/bin/python2.7.
Mac comes with default python installation which is not removed. It can be accessed from /usr/bin/python.
Macports installs it's tools under path /opt/local and binaries at /opt/local/bin. So now you will have multiple versions of python and located at different location so that you can choose which one to run.
The packages installed with a particular version of python will go in it's site-packages and will not be available to other versions of python installation.
[Edit: based on comments]
I have multiple versions of standard python installation.
~ $ /usr/bin/python
python python2.5 python2.6 pythonw pythonw2.6
python-config python2.5-config python2.6-config pythonw2.5
With python2.5, I get:
>>> print platform.architecture()
('32bit', '')
>>> sys.maxint > 2**32
False
With python2.6, I get:
>>> print platform.architecture()
('64bit', '')
>>> sys.maxint > 2**32
True
See the note at - http://docs.python.org/library/platform.html