How can I install Python 3x and 2x into same machine? [duplicate] - python

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Can I install python 3.x and 2.x on the same computer?
I am learning Python which I started with 3.2. Now I know basics and want to use some frameworks to learn web development. Here, I came to notice Django doesn't supports Python 3x yet.
So, I need to use Python 2x on same machine. How can I install both?
PS. I am currently using Windows XP.

Just install them normally. By default each version of Python is installed to a different path, and won't conflict. Python 3 and Python 2 don't even use the same executable name (python vs python3), so there's not a lot to worry about.

they will install into C:\Python27, and C:\Python32 by default.
no conflicts.

i didn't want to answer this but i have to since you might have a problem that no one is talking about lol
first don't install python from the official website go to activestate and download activepython for python 2,7
here's a direct link
http://downloads.activestate.com/ActivePython/releases/2.7.2.5/ActivePython-2.7.2.5-win32-x86.msi
activepython will help a lot when downloading packages trust me, so to install django, open pypm and type pypm install django
learn python 2.x and not 3.x because:
1-All the modules work on 2.x and not 3.x, python is a modular language, it's useless if you can't find modules
2- python 2.x will be there for at least 5 years so there's a long time for you to get started on 3.x maybe by then it will be more supported
3-now we are using 2.7, starting from 2.5 python started doing small changes to help programmers have a smooth transition from 2.x and 3.x, so when 2.9 arrives it will look a lot like 3.x
4-if you installed 2.7 and 3.2 on xp and lets say you made 2.7 your default version, which is the right thing to do, then there's a big possibility that 3.2 won't work, it will give you this error: Error runtime
program C:\python32\pythonw.py
this application has requested the runtime to terminate it in an unusual way, please contact the application support team for more information
so it will just give you a headache lol

Related

Is SimpleHTTPServer available if Python is installed?

I am working on a small education project which will use Python SimpleHTTPServer from a shell script to serve static files from a folder like this:
python -m SimpleHTTPServer
I am not sure on which platforms the project will be run.
I don't think users will run it in some exotic environments - generally OSX, Linux, Windows.
Will it be enough to write in docs that Python is required to run it?
No, this will not be sufficient in 2018, and even less so in the future. You should tell them to use python3 -m http.server, and that Python 3 is required, but with a note saying they can use SimpleHTTPServer from Python 2 if they have that instead—and probably mentioning than Mac users do already have Python 2 instead.
(I'd like to say that you can get away with ignoring Python 2 entirely, because anyone who chooses to use it ought to know what they're doing by this point, but thanks to OS X, you can't quite get away with that yet.)
Windows: Users who go to python.org to install Python will be presented with 3.6 as the first choice, and 2.7 as the second choice. And in a year and a half, 2.7 will likely be moved to the "old versions" page along with 3.5 and 2.6.
Mac: Python 2.7 comes preinstalled. If they go to python.org, or use Homebrew, they'll be presented with 3.6 as the default, but if they know that they already have Python, they won't try that. And Apple may well keep shipping 2.7 long beyond 2020.
Linux: Current versions of most distros have 3.x preinstalled, and some do not have 2.x. And in a year and a half, most of the big ones are planning on relegating 2.x to community-package status. However, there are plenty of people still using older "Long-Term Support" versions of their distros, and these will continue to support (and maybe pre-install) 2.7 until they go out of support, which ranges from 2-8 years from now.
SimpleHTTPServer is only available on Python 2.x.
For 3.x you need to run it as python -m http.server.
Also, it might be worth mentioning that you can add port as an extra argument. (python -m http.server 1234 or python -m SimpleHTTPServer 1234)
Referring to in in the documentation should be enough I guess.
Linux and OSX should come with python preinstalled. (As far as I know).
For windows this isn't always the case. Some installations do, some don't.

Python3 Django project use the Python2 library

I have a project with Python 3.5.4, but I want to use a Python library called pyghmi, but the library only supports the Python 2.x.
How can I solve this issue?
The project was updated for python3 and is tested with python 3.5, though I will confess the vast majority of users are using python 2.7 at the moment. The building of rpms, however, has not yet been tested for python3 (so far system python of centos 6 and centos7 has been the rpm environment).
I would be interested to know the issue you are hitting.

Remove third-party installed Python on Mac?

So I installed python 2.7.11 a few months ago, now the class I'm about to take uses 3. So I installed 3 and it works fine. I also uninstalled 2.7.11 by going to applications and removing it, but going to terminal and typing which python, the directory is Library/Frameworks/Python.framework/Versions/2.7/bin/python, which means this it's still not removed.
What should I do...leave it alone? I only need Python 3, but this is bothering me a bit.
Thanks.
This doesn't answer the question in the post's title, but leave Python 2 as the default python. If you want to run Python 3, you run python3 or maybe python3.4 or python3.5, depending on your installation. The system and other third-party software depend on python being Python 2. If you change it, you may encounter puzzles down the road.
I'm not sure if having a third-party Python 2 is good (OS X ships with Python 2 already), but it should be fine.
Edit: Sorry, didn't see there was already an answer. It was posted as I was typing.

python 2.6 vs 2.7, for pylons/pyramid projects

What problems can I have if I will use python 2.7 instead python 2.6 for my pylons/pyramid projects? Before I use python 2.6 on my ubuntu 10.04 but now I have ubuntu 11.04 on my laptop with python 2.7.
If you're using Ubuntu the package manager will fix most of the minor issues such as finding the packages you used to have in 2.6.
But there are some Packages that isn't compliant with Python2.7.
Mainly Python2.7 is a backwards compatible version from 3.X, or at least Python 2.7 was an upgrade from 2.6 towards the 3.X syntax and all it's new functions while the translation to 3.X was made.
Here's some info:
http://docs.python.org/dev/whatsnew/2.7.html
http://www.python.org/getit/releases/2.7/
Mainly Python2.7 should just give you more functions but can cause unexpected problems,
Go ahead and upgrade it on a seperate machine, run your code, if it works, upgrade your real machine to Python2.7.
The problems that might occur are minor, you should be able to fix them within 1h.
According to this post, Pyramid 1.2 (as is 1.1) is fully supported on Python 2.5.x, 2.6.x, and 2.7.x so you should be all set. From my own personal experience,I haven't run into any issues with Pyramid/Python2.7.
These days my Pyramid stack consists of:
python 2.7
khufu
sqlalchemy 0.7.x
and it works quite well.
Take a look at http://docs.python.org/dev/whatsnew/2.7.html
You'll find what all you'll ever need to know.

Getting shogun ML library to work with python

I was trying to install shogun on Windows:
http://www.shogun-toolbox.org/doc/installation.html
but evidently it requires python 2.5 to work. I tried with python 3 and it didn't work. But then python 2.5 no longer exists.
Does anybody know how to get it working with python without using python 2.5?
You won't get very far trying with Python 3 (which is not fully compatible with Python 2.x).
Furthermore, the installation instructions say:
"SHOGUN requires the standard linux
utils like bash, grep, test, sed, cut,
ldd, uname gcc g++ cat python"
sounds like you are out of luck on windows, unless you resort to Cygwin.
There are currently two Python languages out there
the original one, which is still being updated (currently at 2.7.2)
the overhauled Python 3, which is breaking compatibility (currently at 3.1.4)
Many libraries have not switched to Python 3 yet, and might not for some time, so you're better off getting 2.6 or 2.7.
For Windows or Mac, I can recommend the Enthought distribution (free for academic use), which contains loads of goodies, including scipy, which you'll very probably need -- and installs hassle-free!

Categories

Resources