Python2.6 Backtrack/Ubuntu wxPython - python

I wrote a python app and it needs python2.6. I'm trying to get it to run in Backtrack 4 which is a pen-testing linux distro based on debian/ubuntu. I'v managed to install python2.6 along side of python2.5. Now I'm trying to install wxPython for 2.6 from the repos but I can't get it to install it for python2.6 rather than 2.5. Is there some way i can set a flag to specify what python installation to target? Or do I just need to install it from source?

There is pre-built version of python, wxwidgets, wxpython in ubuntu packages.
You don't need to build from the sources(unless you have special reasons), you can install it from the following links.
http://packages.ubuntu.com/jaunty/python2.6
http://packages.ubuntu.com/jaunty/libwxgtk2.8-0
http://packages.ubuntu.com/jaunty/python-wxgtk2.8
And also wxPython 2.8 is recommended, you still can find 2.6 though.

Related

Modules installed but not found by Python in Raspberry Pi 3

I have a Raspberry Pi 3 with Raspbian and I upgraded python version from 3.7 to 3.8. If I type python --version in the terminal the correct version appears as the system version. However none of the modules that I have installed AFTER the version change seem to work. Python gives ModuleNotFoundError when trying to import ANY of the modules that I have installed.
I can see the modules with pip freeze but Python seems to not be able to find them.
I followed this instructions to purge 3.7. I reinstalled pip after purging python 3.7 but pip as again installed in /home/pi/.local/lib/python3.7/site-packages/pip. How can I get rid of 3.7 completely?
python3.8 -m pip install SomePackage # specifically Python 3.8 should work.
More documentation here: https://docs.python.org/3/installing/index.html#work-with-multiple-versions-of-python-installed-in-parallel
Just to summarize the comments and suggestions from other answers:
The problem I have was caused by the fact that even I had set Python 3.8 as default and python -v was pointing to Python 3.8 the pip script was installing modules for Python 3.7.
The suggested solution was to use pip3.8 (or whatever version someone might have) to install packages for that equivalent Python version and that works good.
Ideally best option if someone wants to have multiple versions of python is to use pyenv. You can create multiple virtual environments with multiple python versions.
However Do not uninstall the default Python. I have also tried to uninstall the default Python 3.7 to avoid having two versions of python 3 and keeping track of which module is installed where. This was a bad idea. I did not know that many Linux distributions have applications which use the default Python. You might get a black screen and who knows what other problems see this discussion Removed Python 3 on 18.04, how can I fix my system?

Is it possible to use Cocoa API with Python?

I was wondering if it is possible to use Cocoa (Apple's API) with Python, so being able to run any code like in this link, so NSWorkspace functions and so on, this might be a super stupid question, but I was still wondering if it was possible...
Yes.
There are Python packages, kind of wrappers around Objective-C, install them like:
$ pip install pyobjc-core
$ pip pyobjc-framework-Cocoa
$ pip pyobjc-framework-Quartz
https://pypi.org/project/pyobjc-framework-Cocoa/
MacOS by default comes with python 2.7 and pyObjC 2.5, and has done for years. If you want a newer version of either python, such as python 3, or the newest version of pyObjC, then you have to install it yourself.
The latest version of pyObjC is 5.2.
However, on a default installation of MacOS from at least Snow Leopard onward, the following should work:
python
>>> import Appkit
>>> AppKit.NSWorkspace.sharedWorkspace().runningApplications()
Catalina is stated to be the last version to contain python bundled.

How do I install tkinter on Python 3.6 on Debian?

My partner decided to use Debian for our dedicated server, whereas I am more of an Arch Linux person. But alas, people online recommended Debian to him so we ended up using that.
The issue is: some of our projects use matplotlib, which requires tkinter. However, this package was NOT installed when we installed python3.6 using apt-get.
A few google searches recommended apt-get install python3-tk, but this installed tkinter for python3.4, which Debian came with (which is odd to me as 3.6 is fairly standard these days).
As python3.6-tk was not listed, I decided to ask for help in here.

Is it possible to run two versions of Python side-by-side?

I've been learning Python for a couple of weeks, and although I've been successfully develop apps for Google App Engine with Python 2.6.5, it specifically requires Python 2.5.
Being mindful of compatibility issues when uploading apps (it's a situation I'd rather avoid while learning Python), I wonder if it's possible to have 2.5 and 2.6.5 installed on the same machine. Ideally I'd like to use 2.6.5 as the default, and configure GAE to somehow use 2.5.
Absolutely.
If you're on *nix, you'd usually just use make altinstall instead of make install, that way the "python" binary won't get installed/overwritten, but instead you'd have e.g. python2.5 or python2.6 installed. Using a separate --prefix with the configure script is also an option, of course.
Some Linux distributions will have multiple versions available via their package managers. They'll similarly be installed as python2.5 etc. (With the distribution's blessed/native version also installed as the regular python binary.)
Windows users generally just install to different directories.
Yes, it is possible to install multiple versions of Python "side-by-side".
On Ubuntu, you simply install with
sudo apt-get install python2.5
(On the current version of Ubuntu, 10.04, python2.6 comes installed by default.)
To use python 2.6, just call python or /usr/bin/python.
To use python 2.5, you call /usr/bin/python2.5.
If you tell us your operating system, we may be able to provide more relevant details.
Another possibility is to use virtualenv.
OK, I figured out the answer to my own question, partly with the help of Nicholas Knight who pointed out that you just install different Python version to different Python directories. I was left scratching my head on how to get Google App Engine to use Python 2.5 (the required version) instead of Python 2.6. This is the answer:
1) Install Python 2.5.
2) Install Python 2.6 (or a more recent version), afterwards. This will be the system default.
3) Install the Google App Engine SDK.
4) Launch, "Google App Engine Launcher" from the Start Menu
5) Click Edit > Preferences, and enter the path to the pythonw.exe executable. Usually c:\Python25\pythonw.exe

Install PyObjC on Python 2.6 on OS X 10.5?

OS X 10.5.8 came with Python 2.5, and had PyObjC already installed.
I installed Python 2.6 from the python.org site, and PyObjC isn't there.
I can't find a download to install PyObjC on my Python 2.6 install. Is checking out the PyObjC trunk and trying to build it my only choice? Will that work "out of the box"?
Apple includes PyObjC with their Pythons that come with OS X 10.5 and 10.6. It is not part of the python.org installers. But it should be easy enough to install. Just install setuptools to the python.org python 2.6 following the instructions here. Then use easy_install-2.6 (which will have been installed in /Library/Frameworks/Python.framework/Versions/2.6/bin and may already be on your $PATH) to do:
easy_install-2.6 pyobjc==2.2b2
as described here. If you want to live on the bleeding edge, you could try installing directly from the svn repository as there has been a lot of work recently, primarily in support of 10.6.
If that seems like too much work, you could install an older version and all dependencies including python via MacPorts:
sudo port install py26-pyobjc2
You should probably try to build PyObjC from trunk, which will work fine on the official Python 2.6 distribution, but not on Python 2.5. There are quite a lot of fixes in the trunk right now that weren't in 2.2b2, which afaik. is the most current version available through easy_install.
There are some little snags that you may run into when building with py2app on 10.5 + 2.6 + PyObjC 2.2 (which for a lot of reasons is what you should probably do, instead of using the Xcode templates from 10.5 that build differently), especially if you still have Python 2.5 installed somewhere, so you'll probably want to build and install py2app from trunk as well, this particular issue I ran into with PyObjC 2.2 on 2.6 on 10.5 has been fixed by now.
If your goal is to write software that will work on other people's computers, you shouldn't touch the default Python installation. If you simply cannot live without 2.6, then you're responsible for re-creating everything on your own, and that's not going to be a point-and-click process by any means.

Categories

Resources