How do I 'down grade' to python2.7 - python

Being quite cavalier I went for the latest version of Python (3.2.2)
Unfortunately it lacks the matplotlib that I desperately need.
I have downloaded python 2.7.
My simple question is weather I have to uninstall python3.2 or can I leave it on my windows 64 system?

you can keep the python 3.2 installation, but you will have to be carefull about which version you launch (by making the call explicit). you can always check the python version in a script by doing:
import sys
print sys.version
If you have no particular use of python 3.2, I recommend uninstalling it.

I'm not sure if there's a difference on python in windows but on mac and linux I simply call older versions using
python2.6 or python2.7
It seems to keep all the versions I previously had before. Maybe try running the above command and seeing if it works on windows and if it does just change the symbolic link 'python' is pointing to.

Related

How to remove python 2.7 from Mac OS X 10.14.5?

I realise that there is already an answer for the question but its for Mac OS X 10.6.4 and the python he installed was from "python.org". My python 2.7 has come built-in in my Mac so how do I remove it? Is there any way of removing it? I have installed a python3.7 from the website and it is working perfectly but 2.7 is also working. I want to remove 2.7 and make it such that when i type "python" in terminal it runs python3.7 and not 2.7.
You don't have to remove python 2.7. You can simply add the command as an alias (you can also add this in your ~/.bash_profile file):
alias python='python3.7'
Do not remove python 2.7 (default python package), it may damage your operating system.
If you want you can simply use this command (removes the python installed with homebrew):
brew uninstall python
Refer this question if you really thinking of removing python 2.7. Here is another question which will give you more information.
the 2.7 version of python is a bundle that comes along with the MAC Unix operating system. which means maybe you not using it but there are some pre-loaded programs and dependencies which uses python hence you cannot remove it completely. If you want to use python 3 directly from the terminal's command line just use "python3" in place of "python". this will launch python 3.* what ever you have installed.
A Mac has more Pythons than a Malaysian jungle.
A new Mac M1 has version 2.7 in /System/Library/Frameworks/Python.framework/Versions/2.7
If you use Homebrew to install Vim, it uses /opt/homebrew/Cellar/python#3.9, and it warns you if you delete it, Vim won't work.
Meantime, I want to do the introductory tensorflow machine learning course, and it insists on Python 3.8
So in my .bash_profile
alias python='/opt/homebrew/Cellar/python#3.8/3.8.8_1/bin/python3'
alias python3='python'
alias python3.8='python3'
and I deleted all references to Python2.7.
But when I open a new terminal, and run a Python program which does
print(sys.path)
it includes /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
and tensorflow won't work. The Mac is inserting its own Python into what I want.

Trying to run python 2 and python 3 on the same machine, having problems with 2.7 tkinter

I had python 2.7 on my machine running just fine. I decided to install python 3.3 on my computer and changed my environment variable path to C:\Python33 instead, intending that to be my main one. Running IDLE on python 3.3 works just fine, but for some reason, IDLE (and Tkinter) in python 2.7 no longer works. When I run the following command in the command prompt:
PS C:\python27\lib\idlelib> C:\python27\python.exe idle.py
** IDLE can't import Tkinter. Your python may not be configured for Tk. **
Clearly I'm doing something wrong, or my installation of 3.3 messed something up. Can anyone help?
This is just a idea but python 2.7 and 3.3 versions have minor differences on coding ex - input and raw input difference. So i think the version developers make a exception if you run your 2.7 code on 3.3 compiler.
My suggestion better have 2 environment variables for both versions because as i told before syntax are different from 2.7 to 3.3 minor way .
My memory isn't perfect...but for encountering this question much later and wondering, I ended up fixing my problem by uninstalling both versions (a pain, I know) and reinstalling with Python 3.3 first and Python 2.7 second. For some reason, after this I was able to run both versions of IDLE (in their respective folders) with no problem.

Cannot get python IDLE 2.7, 3.3 to run - OS X

I am running a MacBook Pro with 8gb of memory and a 2.5GHz processor. I run OS X Mavericks, but this problem has happened on other operating systems as well. when I try to open the editor, or even open a python file, this happens:
This has been a problem since I got into python. I have tried as many versions as I can, and the same screen pops up. Please help
I recently also upgraded a friends iMac to OS X 10.9 Mavericks and her Python to 2.7.6. If you mount the python-2.7.6-macosx10.6.dmg disk image there's a text file named ReadMe.txt. If you ahem, actually read it, right near the beginning it says:
**** IMPORTANT ****
Update your version of Tcl/Tk to use IDLE or other Tk applications
To use IDLE or other programs that use the Tkinter graphical user
interface toolkit, you may need to install a newer third-party version
of the Tcl/Tk frameworks. Visit
http://www.python.org/download/mac/tcltk/ for current information
about supported and recommended versions of Tcl/Tk for this version of
Python and of Mac OS X.
Here's what http://www.python.org/download/mac/tcltk currently looks like (my highlighting):
To summarize: You need to download and install ActiveTcl 8.5.15.1 (which is mislabeled ActiveTcl 8.5.15.0) from ActiveState's webpage. After doing that you should be able to run IDLE:
I haven't actually tried to do it yet, but from what I read it sounds like the same process applies to Python 3.3.3 and its IDLE app.
I was having the exact same problem.
I was finally able to install Python (and IDLE) via MacPorts by also installing a package called "pyXX-tkinter" -- where XX is the version, e.g. py34-tkinter for Python 3.4.

installing IPython with two versions of Python (Windows)

Is it possible to have IPython (0.12) installed on the same
system with two different versions of Python (v 2.7 and 3.2)? Currently I have both versions of Python running happily on my system.
I am using two machines, one with Windows 7 64-bit, the other XP SP2 32-bit, and both have Python 2.7.2 and 3.2 installed. I have been using IPython with Python 2.7 w/o any problems for a while on both.
Now I would like to have 3.2 available too with IPython, but when I try to run the binary windows IPython installer I get this error toward the end of the install:
*** run_installscript: internal error 0xFFFFFFFF ***
and no shortcuts/entries into Start Menu etc are created.
(I ran the install as adminstrator under Win 7) I am running into the same problem with XP and Win 7.
After poking around the net and SO for a while I saw references for
getting setuptools. Unfortunately, there's no version for Python 3.x
but it was suggested to use distribute.py instead which I ran and
installed. I am not sure how to proceed next. And I'm not even sure it
is possible to do this (though I think it is :)
Any suggestions?
UPDATE: There was a problem with import readline not working with Python 3.2.3, but I was able to fix it by downloading pyreadline-2.0-dev1.win32.exe which works with Python 3.2.3 .. the above problem remains unfortunately.
Ok, here's my solution to get IPython 0.12.1 to work with both Python ver
2.7.x and 3.2.x on the same system (ie. under Windows 7 64 bit and XP SP2 32 bit). It's not
perfect, but works, and hopefully will help others. Where I am showing directories they refer to XP (but should be adjusted accordingly for Windows 7)
Steps for both:
Install both versions of Python via the binary windows installer provided at
Python.org
Install this version of pyreadline pyreadline-2.0-dev1.win32.exe which works
for both versions of Python (I could not get the widely available version 1.7 to work with Python 3.2.x)
I am not sure if distribute.py is necessary, I'd skip it on the
first try.
Download ipython-0.12.1.zip file and extract it. Place it under your Programs directory and cd into it (I'll call this the ipython_dir) [I tried the binary installer numerous times without success]
For Python 3.2 (easier)
In the ipython_dir:
c:\python32\pyton.exe setup.py install
will create ipython3.exe in c:\python32\Scripts that can be used to
fire up iPython
For Python 2.7 (a bit odd)
The above method failed. However, it is possible to start IPython from the ipython_dir with
c:\python27\python.exe ipython.py
I can't explain why this is so, but since I use Console2 I can hide
these two ways of starting IPython.
Summary:
To start IPython with v 2.7.x of Python:
c:\python27\python.exe "C:\Program Files..\ipython_dir\ipython.py"
To start IPython with v 3.2.x of Python:
c:\python32\Scripts\python3.exe
That was a lot of work and took most of the day, so I hope posting the steps above
will save someone else a lot of time (and help me remember what I have to do next time I struggle with this)
Thanks everyone for their suggestions.
Addendum: None of the above resulted in shortcuts or entries in the Start/Program Menus. Shortcuts can be created manually, or in my case aren't necessary since I'm using a special shell (Console2) to run IPython.
The first question in the iPython FAQ titled "Running IPython against multiple versions of Python" may help.

Python 2.7.1 can't see Twisted

I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1
Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory.
"which python" returns "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
and running python returns the same: "Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)"
I have added the twisted directory (absolute) to sys.path, and I have added it to .bash_profile, which now consists of the following:
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
PATH=$PATH:/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted
export PATH
Any ideas how I can get 2.7.1 to see the Twisted install? Or am I trying to do something that just can't be done?
thanks.
You'll need to install Twisted into your Python 2.7 installation somehow. The "2.6" in that path should be a hint that you shouldn't be trying to tell Python 2.7 about it. Among other things:
Extension modules are not compatible between python versions. You may get a segfault if you try to use them.
Bytecode formats are not compatible between python versions. Python will fall back to parsing '.py' files, which is slower.
If you're using an operating system that ships with Python 2.6, there is a good chance that the version of Twisted included is not compatible with Python 2.7, since Python 2.7 may not have been out yet when it was released.
You'll have to install twisted using python 2.7.
Also, python doesn't look up what's in the PATH variable for imports, it looks in PYTHONPATH. But just putting your python 2.6 folder in your pythonpath isn't a very good solution.
Create an environment using virtualenv.
Install Twisted in your newly created environment using pip.
You need to set up an environment for your new Python 2.7 or use the OS installed 2.6.
OS X ships with NumPy for example, but your new Python 2.7 will not 'see' it.
The best solution (IMHO) is this:
o Don't change the OS default Python AT ALL!
o Install Python 2.7, 3.0 as you wish with the system Python first in the path
o Use virtualenv to set up a personal Python environment -- a sandbox. Install twisted into that.
o Install libraries into the environment you are going to use for the job. Might mean duplicates.
o Use your shebang to execute the proper Python

Categories

Resources