Python version settings - python-2.7

I work on Ubuntu with Wingware Python IDE. The version, which we use by our projects is 2.7.X
This morning I updated the IDE, and it became a version >3.x.x
Now I want to install the old version 2.7.3, after I read TFM and try to define PYTHONPATH, I check my Python version on Ubuntu with the command:
python --version
and got the answer 2.7.3. Now I can not understand, why I have version 3.x.x in Wingware and how exactly (the import file is not clear) I can change my version after setting Python manually described here
Actually: It depends on wingware, because I can execute Python 2.7.3 in IPython and in console.
EDIT: I solved this problem myself. Here's my solution:
Following the manual:
Use Python - Executable
Use Interpreter to find right path (in my way it was /usr/bin/python3.2)
Go in /usr/bin/
Select right Python version. This path has ALL Python versions, you should just select the right one

I solve this problem someself. I post now my solution for other people.
After [manual][2] using:
Use Python - Executable
Use Interpreter to find right path (in my way it was /usr/bin/python3.2)
Go in /usr/bin/
Select right python version. This path has ALL Python version, you should just select the right one

Related

How to find the correct version of PyBindGen for Python Bindings

Currently, I am working on the Ns3 simulator and now trying to enable the pyviz visualizer. According to the doc, I have downloaded the three dependencies which are
py27-pygtk
py27-pygoocanvas
py27-pygraphviz
Now in order to use this, I still need to enable the python bindings which I used /usr/bin/python2.7 ./waf configure wanna to check what needs for enabling python bindings. The result shows that
Python Bindings : not enabled (PyBindGen version not correct and newer version could not be retrieved)
So I checked the Doc and downloaded PyBindGen (version 0.18.0). The output shows
Installed /Library/Python/2.7/site-packages/PyBindGen-0.18.0-py2.7.egg
Processing dependencies for PyBindGen==0.18.0
Finished processing dependencies for PyBindGen==0.18.0
After I ran the configuration check the results still showed that PyBindGen version not correct and newer version could not be retrieved
So I presume that is that because I installed the wrong version of PyBindGen? If so how can I get the suitable version for enabling Python Binding?
I would appreciate if there is someone who can help me figure it out. Many thanks.
S.
According to the Google Group
Here is the resolution(tested it worked):
follow the instruction
hg clone http://code.nsnam.org/ns-3-allinone
cd ns-3-allinone && ./download.py
This will solve the Python Binding problem
Updated: after downloading this version of ns3. Solving the python binding problem. Then there will be another problem after running
./waf configure
it will show the result like this:
PyViz visualizer: not enabled (Missing python modules: gtk, goocanvas, pygraphviz)
Even though I have installed all of the three dependencies. So after some researches I found that there has another questions post So there is a guy gave the guessing that
" Waf found the standard Python here (/usr/bin/python is the Apple path), and you installed the python libraries using MacPorts.
Most probably you'll need to configure Python to point to the MacPort-based Python, or it will not see what you installed."
So according to How to: Macports select python
here is the solution:
port select --list python
sudo port select --set python python27
Hope it will help anyone come afterwards to use this.
S.

Easiest way to have Python 2 and 3 coexist on Mac OSX 10.8 with Anaconda installed

I am using python 2.7.10 with Anaconda 2.3.0, and I use the Anaconda IDE with sublime text 3 (is it a different Anaconda??).
However, for a course I'm taking we're required to use python 3.5.
I would like to keep python 2.7 on my computer, though. What would be the easiest way to have both versions coexist and be easily accessible through the terminal (through sublime would be great, but I'd be happy with managing it on the terminal for now)?
Also, I typically run conda update conda, and conda update anaconda on a regular basis to keep everything up to date. How would that work with different versions of python installed?
This sort of thing is actually what Anaconda is built for. Although the default Python version depends on the installer you used, Anaconda supports both versions. The easiest way is to create a new virtual environment. From the following link, use this conda command to build a Python 3 environment:
conda create -n py35 python=3.5 anaconda
That is if you need Python 3.5 with all the anaconda packages. You can either leave that blank if you just want a vanilla version of Python 3.5, or specify individual packages.
Once you do this, Python 3.5 will be available with the console command py35. You should definitely read the following link about how to manage environments. Really, you should read that whole tutorial.

How can I change the version of python being used by IDLE?

I have both python 2.7 and python 3.4 installed on my mac.
IDLE is using the latter, how can I change that ?
I looked for idle in python2.7 folder under /Library/Python but all I can find under Python2.7 is a folder having the name site-packages.
you may try by changing the system variables....I don't know particularly about mac but in window we can do so.You may refer the following link.
=======================
https://www.youtube.com/watch?v=IX6mc9l6tY4

too many pythons on linux

i recently started using python with xubuntu on virtualbox but i'm having problems. I want to be able to use numpy so i thought that apt-get install python-numpy would solve everything, but using the shell i kept getting No module named numpy. I used IDLE and it could find it. I also have IDLE (using Python-2.7), and again it could import numpy. Then i noticed that the shell had python 2.7.9, while the IDLEs had python 2.7.6.
Using
import sys
print sys.path
this if what i get from 2.7.9 (shell)
/usr/local/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg
/usr/local/lib/python2.7/site-packages/Pillow-2.3.0-py2.7-linux-x86_64.egg
/usr/local/lib/python2.7/site-packages/mock-1.0.1-py2.7.egg
/usr/local/lib/python27.zip
/usr/local/lib/python2.7
/usr/local/lib/python2.7/plat-linux2
/usr/local/lib/python2.7/lib-tk
/usr/local/lib/python2.7/lib-old
/usr/local/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
and from 2.7.6 (IDLE)
/home/alessandro
/usr/bin
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/pymodules/python2.7
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
I understand that i have two versions of python installed and somehow i ended up installing packageg into only one of them (the 2.7.6).
I'd like to be able to use 2.7.9 both in the shell and in IDLE and also i'd like to install so that python 2.7.9 can see them.
I read that i can add paths to the python sys.path, but isn't there a more efficient/persistent way to do what i want?
PS: tell me if you need more informations
For my projects I usually create a virtualenv for each python version I need for the project at hand. I manage them using pip to install specific versions that I need. Moreover you should be able to choose the python path in your IDE. While I'm not using IDLE, I read here that apparently idle comes along with the python versions during install. So maybe your idle versions collide with each other. If you want to have only one python version at the time on your machine you might consider a simple remove and fresh install of your desired version. Again I would recommend pip over apt-get etc. Hope this is of help for you.
Worth to check PyDev, a plugin for Eclipse to work on python.
http://marketplace.eclipse.org/content/pydev-python-ide-eclipse , or http://pydev.org/.
This allows you to configure the python version for different project's.
I have some project's with python 2.7 and others with 3.4.
it's checks the whole system in search for the PYTHONPATH to use!

How can I remove a version of Python in Ubuntu 12.04?

I have just installed Ubuntu 12.04 which comes with Python 2.7. I have installed Python 3.3, so now I have both versions. For example, if I type python in the terminal I get version 2.7 and if I type python3.3 I get that version.
I don't see why I would need 2 versions (?) so how do I uninstall Python 2.7? And if I do so, will the "python" command then point to Python 3.3?
VERY IMPORTANT EDIT
Removing an older version of python may be very dangerous and can cause trouble in your whole system! For your case instead of removing the older python you can simply use an alias in your terminal, so that when you type python it opens python3.3;
Here is the procedure, add this line:
alias python=python3
Into~/.bash_aliases or: ~/.bashrc
Btw I guess If you ask this question in AskUbuntu you may have a quicker/better response!
You should never remove the builtin Python in your Ubuntu distribution. Bad things will happen if you do.
It is highly recommended to use virtualenv to install other Python environments.
Here's a good Stackoverflow question that demonstrates how:
Is it possible to install another version of Python to Virtualenv?