is mac good for python programming? - python

I am programming a django based website. I actually use a small computer under Ubuntu 10.04.
I would like to buy something more professional, so I am wondering whether an iMac is good for that, because :
Is there a free IDE as good as eclipse on MacOS ?
Is there a remote python debugger like pydev for eclipse ?
Is there some typical issues with python on MacOS ?
does apache+mod_wsgi works well on MacOS ?

Why do you consider iMac to be more or less professional than anything else? Hardware? System?
Note: I'm myself a MacOSX and Linux user.
Unless it's a requisite, most times I'd say it's only a matter of personal taste.
As said by others earlier, everything you cited works fine on MacOSX.
However, you should consider the 3rd party libraries you're going to use with Python.
I would cite a problem I had with MySQLdb (MySQL-python) on MacOSX, but it has been solved. You might face other problems in the way, but nothing that could stop you from using Django, Eclipse, etc.

All of the things you mentioned (Eclipse+plugins, Python, Apache, mod_wsgi) can run fine on OS X.

My answers based on several years spent developing with Python on OsX:
Eclipse is multiplatform, you can have it on OsX too.
I would not call pydev a python debugger, anyway you have it on Eclipse for Osx
You would have probably the same issues you had under Ubuntu (OsX is Unix based)
Yes it works without problem
One thing I always recommend is to install macports;
with macports installing Eclipse, different Python versions, apache, mod_wsgi is really easy.

FWIW, mod_wsgi is developed on MacOS X. My experience in supporting users of mod_wsgi is however that MacPorts and fink are an absolute PITA. Specifically, trying to use Python and Apache from those third party systems usually causes nothing but hurt. This is based on problems encountered over the last couple of years. I haven't heard much lately though, so it may be the case that those systems have finally fixed up their 32/64 bit issues and Python build problems.

Related

Change default version of python in ubuntu 18.04

I just installed ubuntu 18.04 and I really don't know how does everything work yet. I use the last version of python in my windows system (3.8.1) and would like to use that version as well in ubuntu, but the "pre-installed" version of python is 2.7. Is there a way to uninstall that old version of python instead of changin the alias of the python command to match the version I want to use? Can you do that or does ubuntu need to have that version? If you could help me or explain this to me I would appreciate it.
It's not a good idea to remove Python 2 from your Ubuntu 18.04 because maybe some services or apps are using it (Despite that Python 2 doesn't get support any more)
(In Ubuntu 19.10, we have only Python 3)
The best answer is using Virtual Environments that make an isolate work station for you with any thing you wish, and it doesn't mess with other platforms.
Some services and application in Ubuntu use Python 2.x to run. It is not advisable to remove it. Rather, virtual environments maybe a good practice. There, you can work on Python 3.x, as per your needs, without messing up with the system's dependencies.

Spyder/Python install on MacOS - very frustrating

I have read through various posts here on the pros/cons of a wide array of Python environments. That being said, I am even more confused than prior to engaging in this due diligence.
My application is algorithmic trading, backtesting and analytical tool development and so I know I want the following functionality:
-numpy
-scipy
-Matplotlib
-spyder IDE
It seems like the installation of spyder on macos is non-trivial based on comments posted by users here http://code.google.com/p/spyderlib/wiki/Installation and so before I go down a rabbit hole I was wondering if someone could better guide me on the process and pre-requisites.
I came across the following post on stackoverflow, which seemed to indicate that I could just install the EPD-7.1 distribution and then install spyder separately but I'm not sure if the EPD distribution comes with all of the pre-requisites necessary for spyder.
Python distributions and environments for scientific computing
The following seems to be a guide on how to install spyder on macos but I'm not sure if this is current and whether installation of EPD makes some of the steps unnecessary.
http://works13.com/blog/mac/howto-install-spyder-1-x-on-mac-os-x-with-64bit-python.htm
Lastly, if I were to install EPD - is it better to go with 32-bit or 64-bit.
Thank you very much for your guidance.
Anaconda seems to be exactly what you're looking for: spyder, numpy, scipy, and matplotlib all work right out of the box.
The shortest path to a working analytic environment is the Enthought Python Distribution. The PythonXY build is also nice (easy to install, etc) but has fewer preinstalled features (a lighter footprint).
Spyderlib works cleanly with PythonXY. With EPD, there a couple of open issues:
http://code.google.com/p/spyderlib/issues/detail?id=627
http://code.google.com/p/spyderlib/issues/detail?id=723
I can't think of any reason to prefer a 32-bit build over a 64-bit build.
It depends on what kind of algo trading you intend to do but for anything that is time sensitive (such as actual trading) Python will likely be too slow. That said, it can be a good tool for backtesting and strategy development, although things like Streambase that can do everything might be a better choice.
I was in the boat as well. Too many options and too many opinions. I was also very much lost and to be honest, still feeling a bit soo! I am new to python and I am also not a proficient user of the terminal on Mac OS. Still, I managed to do the following to get spyder3 running on my new Mac running on High Sierra 10.13.4
Install Python3 using terminal Mac OS command:
$ brew doctor
$ brew install python3
(please note that my Mac OS High Sierra already had Python 2.x installed in it and I did not touch it. )
Then I installed Spyder using the recommended approach described here
https://github.com/spyder-ide/spyder/releases
Hope it helps!

Portable Python (Mac -> Windows)

I have a lovely Macbook now, and I'm enjoying coding on the move. I'm also enjoying coding in Python. However, I'd like to distribute the end result to friends using Windows, as an executable.
I know that Py2Exe does this, but I don't know how portable Python is across operating systems. Can anyone offer any advice? I'm using PyGame too.
Many thanks
The Python scripts are reasonably portable, as long as the interpreter and relevant libraries are installed. Generated .exe and .app files are not.
Py2exe generates Windows executables, so they will only work on the Windows Platform. The FAQ at http://www.py2exe.org/index.cgi/FAQ has more information on how it all works. Essentially it provides what is needed to run on Win9x as well as more current platforms. NOTE: the FAQ mentions some potential gotchas with character encodings and the work arounds.
With python, it is common enough on Unix based systems, as several Linux distributions have their custom maintenance scripts written in the language. So the Python scripts will be just as portable as Ruby scripts, etc. As long as the target machine has the interpreter and you are not using external programs that are only on one type of platform, others will be able to use your work.
Personally I experienced huge difficult with all the Exe builder, py2exe , cx_freeze etc. Bugs and errors all the time , keep displaying an issue with atexit module.
I find just by including the python distro way more convinient. There is one more advantage beside ease of use.
Each time you build an EXE for a python app, what you essential do is include the core of the python installation but only with the modules your app is using. But even in that case your app may increase from a mere few Kbs that the a python module is to more than 15 mbs because of the inclusion of python installation.
Of course installing the whole python will take more space but each time you send your python apps they will be only few kbs long. Plus you want have to go to the hussle of bundling the exe each time you change even a coma to your python app. Or I think you do , I dont know if just replacing the py module can help you avoid this.
In any case installing python and pygame is as easy as installing any other application in windows. In linux via synaptic is also extremly easy.
MACOS is abit tricky though. MACOS already come with python pre installed, Snow leopard has 2.6.1 python installed. However if you app is using a python later than that and include the install of python with your app, you will have to instruct the user to set via "GET INFO -> open with" the python launcher app which is responsible for launcing python apps to use your version of python and not the onboard default 2.6.1 version, Its not difficult and it only takes a few seconds, even a clueless user can do this.
Python is extremely portable, python pygame apps cannot only run unchanged to the three major platform , Windows , MACOS ,Linux . They can even run on mobile and portable devices as well. If you need to build app that runs across platform , python is dead easy and highly recomended.
If you are planning to include Linux in your portability criteria, it's worth remembering that many distributions still package 2.6 (or even 2.5), and will probably be a version behind in the 3.x series as well (I'm assuming your using 2.x given the PyGame requirement though).
Versions of PyGame seem to vary quite heavily between distros as well.

What linux distro is better suited for Python web development?

Which linux distro is better suited for Python web development?
Background:
I currently develop on Windows and it's fine, but I am looking to move my core Python development to Linux. I'm sure most any distro will work fine, but does anyone have any reasons to believe one distro is better than another?
Largely distribution won't matter, as Python is present and largely self sufficient on virtually all Linux distributions.
If you're wanting to focus on development, I'd recommend Ubuntu. Ubuntu is arguably one of the most fully featured "ready for the user" distributions that makes system administration a snap, so you can focus on the development tasks you want to tackle.
If you have a Linux environment that's a target for your code (like say, RedHat or something), then go with the desktop distribution that matches your target environment (like, say, Fedora for RedHat, Gentoo for Gentoo, Ubuntu for Ubuntu Server, etc.)
Otherwise, all of them are suitable.
You distribution should have Python 2.6. Otherwise it's a matter of choice.
One advice: Never ever install anything as root (eg. python setup.py install). Only install things with your distribution's package manager and use virtualenv as a user to install other packages.
Ubuntu has a virtualenv package and it can even be used without being installed.
Using a distribution with the latest stable versions of Python only lets you test your code with those versions. Today it's very easy for developers to test their code with multiple Python versions.
Gentoo probably gives you the most flexibility with multiple Python versions installed at once:
(2.5) 2.5.4-r4
(2.6) 2.6.6-r2 or 2.6.7-r2
(2.7) 2.7.2-r3
(3.1) 3.1.4-r3
(3.2) 3.2.2
That doesn't let you test on some older versions that are very popular on Debian based systems, for example.
pythonbrew lets you compile and install multiple Python versions in your home directory, no root access needed.
It's a snap testing your code with multiple versions of Python thanks to 'tox'. By default, tox will find your system python(s), but you can set custom interpreters you build with pythonbrew, for example.
Here's a tox.ini you can use with Jenkins, for continuous integration. With this setup you can install jenkins then 'su - jenkins' and use pythonbrew to install all the Python versions you want to test.
[tox]
envlist = py267,py271,py272
[testenv]
#You may need to change this. Are your tests here?
changedir=tests
#You can also use nose, etc., see documentation
deps=pytest
commands=py.test --junitxml=junit-{envname}.xml
[testenv:py272]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.7.2/bin/python2.7
[testenv:py271]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.7.1/bin/python2.7
[testenv:py267]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.6.7/bin/python2.6
It's that easy, and it doesn't matter which Linux distribution you use.
See the Tox website for details on configuring Jenkins.
I use RHEL and have been very happy, so from that I would say Fedora would be fine. I use Debian at home, and it's great (headless though, so no web there).
That said, I think you should probably just pick one based on what your company uses, or any number of non-Python reasons. I don't think you are going to find Python tool availability an issue with any Linux distribution.
Most major distributions will include Python and Apache, so it's really just a matter of choice. If you're new to Linux, I'd suggest either Ubuntu or Fedora. Both are great for new users and have excellent community support.
As the other answers have mentioned so far, the Python 2.6 interpreter will be available on all recent Linux distribution releases. That shouldn't influence your choice.
However, your choice of IDE may eliminate some possibilities. You should make sure the distribution you select has a package for the latest version of your IDE, and that it is updated often enough.
As an example, I like to use Eclipse with PyDev for developing Python apps in either OS, but Ubuntu's official repositories had only Eclipse 3.2 (from 2006) until October of last year, when they finally updated to 3.5 in the latest distribution.
I am working with Python on Cento 5.4 and Fedora 12 and I am very happy.
I also use Eclipse IDE for python and other languages without having any major issues.
Any desktop distribution like Ubuntu, OpenSUSE, Fedora, ... is OK, But if you want to always have the latest versions, I recommend ArchLinux.
i think i remember a podcast with Guido Van Rossum and his core team python developers back in the days, and one of that core python developer is now employed by Canonical to take care of python integration for the ubuntu distro. So that explains why ubuntu is a much more pythonic distro compared to other distro.
On the other hand, the gentoo linux distro also has python integrated in its Portage package management system. So gentoo and ubuntu I would say are good for python development system and each represent both ends of the spectrum.

How to install Python on mac os x and windows with Aptana Studio?

How do I get python to work with aptana studio?
I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE?
It's easier than you think. First, there's a version of python on your machine by default. It's kind of out of date, though.
MacPorts is a nice method to get lots of good stuff.
ActiveState has a Python Mac package downloadable for free.
Python.org will lead you to some other options as well.
To add the current Python version on Mac:
Add new interpreter via Aptana Studio 3/Preferences/PyDev/Interpreter-Python.
Give it name (check version using the Terminal and then python or /usr/bin/python.
Then add the path (2.7 in my case): /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
If you install your own (2.6 in my case) use the following path instead:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Don't forget to hit the "Apply" button...
Idle has a complete text editor -- open a "new window" and type away. Be sure to save it before you run it.
What didn't you like about the IDLE editor?
Also, look at Komodo Edit for Mac OS X. Very nice.
For windows, I'd recommend the aforementioned ActivePython. Mainly because it comes with Python win32, which you're going to end up installing anyway.
Secondly, if you're coming from the world of Java and C#, you might be expecting too much out of your IDE. I eventually found that more powerful IDEs just made things more difficult than they helped. So my advice is to try to go with something simple. In other words, go with something that will let you jump in and start coding rather than bugging you with a lot of features you probably won't need anyway. :-)
EDIT: One other thing, find and install pip. It makes installing python packages so much easier.
A lot of the sites in the Windows list mirror the Mac list.
Python.org has Win32 and Win64 installers.
ActiveState has a free Python Win32 package downloadable for free. There is no Win64 version (yet?).
PyWin32 is a Python package with extra modules for interfacing with Windows. This is not Python itself. These haven't been updated for Python 3.0, though. Despite the name, there is a Win64 version for Python 2.6 on this site.
On Mac OS X Leopard and Tiger, Python is already installed.
On Mac, I've tried a few editor. Textmate is my current choice. If you're looking for a free one, I really liked Xcode. But you'll have to run your script from the command line.
If you want a cross-platform environment, you could try Eclipse and the pydev extension. So you don't get lost between the two platform.
For Windows Operating system,
If you want to work with python using Aptana Studio. You have to do some simple basic settings with the interpreter.
For detailed step by step guide. You can follow this website link
http://www.infoknol.com/aptana-python-setup-guide/

Categories