Reputation: 1
I need to install python 2.6.6 or 2.6.7 in Debian 8.2. I am a user. I tried to install but I have a error message: "Failed to found the necessary bits to build the modules......."
I want to do this course: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/
I have python 2.7.9 at this moment. When I run a file(.py) in the shell of Idle I have a error message:
ImportError: Bad magic number in /usr/local/lib/python2.7/dist-packages/lib601/sm.pyc
I think this error is because I have the wrong python version.
Upvotes: 0
Views: 3905
Reputation: 276
I'm currently working with the newest Debian Ubuntu build, which should work identically to your system. While on Windows, one would simply be able to un-install Python, and re-install the respective version, Linux doesn't really work like that. Since Linux is highly dependant on Python, un-intalling it wouldn't be beneficial to your system in any way, and may possibly mess things up a bit. Linux, however, definitely allows for multiple versions of Python.
Since Python 2.6.x is highly unsupported now-a-days, it is rather hard to install. You'll want to install this PPA, which allows the installation of multiple Python builds. You can do it by using the terminal and typing sudo add-apt-repository ppa:fkrull/deadsnakes
. After that, run the update: sudo apt-get update
, and then choose your version of Python: sudo apt-get install python2.6 python2.6-dev
, possibly substituting for other versions.
The 'magic number' error is almost definitely from running an older python file on a newer version -- or perhaps you edited a .pyc file on accident. Regardless, I would, due to preference, not even bother with Idle, and just use the built in terminal, launching python files as so: python test.py
.
Now, if you want to run a Python file through a specific version of python, use: pythonx.x test.py
, 'x.x' being the version number.
Hoped this answer helped!
Upvotes: 0