473,569 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can Python installation be as clean as PHP?

I like Python but I don't really like Python's installation.
With PHP, I only need one file (on Linux) and maybe two files
on Windows then I can run my PHP script. This means no installation
is required in most cases. I just copy the file and I get PHP.
Extending PHP is fairly easy, too, just by copying a few DLLs
and modifying the php.ini a bit.

With Python, things are really messy. I have to run the installer
to install dozens of directories and hundreds of files, and I don't
really know if all of them are necessary. Plus, lots of libraries
are in .py, which is of course not as efficient/clean as having all
of the core functions built-in in the C/C++ core, like in PHP.

Then again, I do like the Python language. It would be great if
Python (or a variation of Python) can be made the PHP way, one
executable file, and you get everything.
May 10 '06 #1
14 1369
If this bothers you, why don't you stick to a linux distro with Python
installed.
Very few don't.

May 10 '06 #2
Jack:
I have to run the installer to install dozens of directories and
hundreds of files,
That's not unusual and not considered a problem by most people.
and I don't really know if all of them are necessary.
Don't let that bother you. Life's too short.
Plus, lots of libraries are in .py, which is of course not as
efficient/clean as having all of the core functions built-in in
the C/C++ core, like in PHP.


Performance-critical parts _are_ implemented in C/C++. But not everything
falls into this category. Yes, there's probably room for more performance
improvements. Just like there is with PHP. Did you know, for example, that
PHP doesn't store and re-use compiled versions of the scripts by default?
With PHP you need to fiddle with eAccelerator, Zend and the like. The
Python interpreter does this automatically.

There are advantages to having library code in Python too, such as being
able to seemlessly debug it in a Python debugger. Also, Python API's tend
to be a lot cleaner than PHP's. This probably reflects the language
they're implemented in.

--
René Pijlman
May 10 '06 #3
> With Python, things are really messy. I have to run the installer
to install dozens of directories and hundreds of files, and I don't
really know if all of them are necessary. Plus, lots of libraries
are in .py, which is of course not as efficient/clean as having all
of the core functions built-in in the C/C++ core, like in PHP.

Then again, I do like the Python language. It would be great if
Python (or a variation of Python) can be made the PHP way, one
executable file, and you get everything.


You have a somewhat distorted view of things. I've been cursing PHP
quite a few times exactly for that monolitic nature. If you need e.g.
oracle support, you have to recompile the whole lot, not just a module
as it has no no C-module concept - so you can't add functionality
besides using PHP-includes. So much for efficiency.

Diez

May 10 '06 #4
Jack wrote:
Then again, I do like the Python language. It would be great if
Python (or a variation of Python) can be made the PHP way, one
executable file, and you get everything.


True, sometimes it can be a real convenience to have this. There are
solutions that implement your solution to some degree. For instance,
for Windows there's Moveable Python (it costs a scant 5 pounds):

http://www.voidspace.org.uk/python/movpy/

I don't believe it's a single file, but it is "installationle ss".
Py2exe and PyInstaller can let you distribute programs as single-file
executables. PyInstaller works on Unix too, IIRC.

If you're good at tweaking stuff and have some knowledge of Python
internals; it's possible to make a minimal distro just by copying files
out of a regular installation by hand (and maybe zipping some them up).
This can be a security and bug risk, so be careful.
Carl Banks

May 10 '06 #5
Please don't compare PHP with Python... They are very different worlds.

Maybe not all the Python's core functions are implemented in C, but
Python is really a lot more efficient than PHP in every case you want
to compare.

If you "look inside", there's nothing to compare... they are extremely
different worlds... they are like hell and heaven, from the awesome
brilliant C Python implementation, to the ugly C PHP hack... (after all
it is my personal opinion, I've worked with PHP for more than 4 years,
for websites and console scripting).

Python is more efficient than PHP in every aspect... I don't know why
got (and still is) so popular, IMHO Python should have taken its place
as the best "web scripting language".

OTOH, my php install have lots more than a single executable file.
Perhaps you don't use any php extension? don't think so... do you use
pear? and pecl? you need lots of files too, and until you don't know
what do they are and what you need or not, you will be in the same
issue as you're with Python. I think you will get it early, as you
find everything is more straightforward than you thought.

Gonzalo Monzón.

May 10 '06 #6
G. Monzón wrote:
Please don't compare PHP with Python... They are very different worlds.


I'm not. I was simply agreeing that the single executable way the OP
claimed PHP does it can *sometimes* be preferrable in Python, and
giving him recommendations thereto.

Carl Banks

May 10 '06 #7
PHP and Python are different languages. They do things differently. You
are just familiar more with one than the other. Give it some time.

The many file approach is the modular design of Python. Having the
standard library separate from the main Python DLL is an advantage, not
a disadvantage. For example, it allows me to pick just the libraries I
want to distribute when I make a single file executables. It allows me
to distribute just the parts of the standard library I want when I
embed Python in another application. Not to mention being able to debug
right into the source.

Most languages take the Python approach. Have you looked at your C
compiler and counted the include and library files? Have you seen Perl
or Ruby to check how their library is distributed? I can think of only
a few languages that take the PHP approach... early BASIC interpreters,
Shells, DSLs and some lesser known interpreters and compilers... none
of which are exactly reputed to be flexible.

How is manually copying files and editing configuration files easier
than clicking through standard distutils installers or typing "setup
install" or better ... using eggs through EasyInstall? BTW, you can
manually copy Python libraries too in most cases to install and PEAR
does offer a package manager for PHP.

Installation has never been a problem for me with Python, if not the
easiest. In fact, among the languages I regularly use, Python is the
only one that includes installer support right in the standard library
(distutils) and I find it surprising that you managed to find it
wanting all because there are more files :-).

May 10 '06 #8
Addendum:
Python has zip imports (similar to Java's jar files). You can put all
your *.py files in a zip file and access them from it if this means so
much to you.

May 10 '06 #9

Carl Banks wrote:
G. Monzón wrote:
Please don't compare PHP with Python... They are very different worlds.


I'm not. I was simply agreeing that the single executable way the OP
claimed PHP does it can *sometimes* be preferrable in Python, and
giving him recommendations thereto.

Carl Banks


Sorry Carl, my reply was for the OP. I pressed the wrong reply
button... doesn't meant you did any comparation!

I said that about comparing, as the OP thought Python coded in Python
approach for a lot of core libraries isn't as efficient as in PHP
'cause they are all coded in C. And that's not true.

Yes, it could be obvious for some people that it "should" run faster
than Python, having all core functions coded in C, yes, but in overall
performance matters, that's not true in any case.

Python has all the primitives C coded as said in this thread. PHP
"primitives " are no more than hash-tables and lots zvals... far away
from the hi-tuned advanced data-types Python exposes. That makes a big
performance improvement over PHP, regards C or Python coded core
functions -let language implementation details apart-. Major loss of
performance in Python and PHP is on translating data values to C side
and all the functions calling done for as little as a value assignment
to a variable. So, sometimes, to code a function in C or let it be
Python, makes no more than a 1us per call difference...
I'd like to see this value compared to PHP. That's why PHP need a C
implementation for all core functions, as if they would be PHP coded,
performance would be even a lot worse.

And I would't say PHP is slow. But It depends on what you need to do.
'Cause PHP can be really slow and ultra-high memory consuming. While
you had this troubles with PHP, is nice to see how Python performs:
consumes a lot less of memory and goes 50 % more fast.

About a single executable file, I thought PHP is being distributed in
windows and linux as an executable plus an dinamic link library, that's
the minimum thing you need to run scripts. So OP is wrong, there is not
a single executable file. You need two files at least + php.ini +
extensions to run almost any PHP script.

And a PHP or Python without extensions or batteries, wouldn't be very
handy... oh well, that depends on the task to do.

Anyway, PHP isn't a bad tool for a *lot* of web-side scripting, but I'd
prefer if I could use Python in many of my work projects. :-) I'd feel
happier !

Regards,
Gonzalo.

May 10 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
97177
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I have written a theme in python for the superkaramba theme engine on kde (see http://netdragon.sourceforge.net - if you are a kde/linux user, it is...
1
1991
by: Tim Bradshaw | last post by:
I'd like to be able to install python with stow, and then to install various modules which use distutils, also with stow. This currently pretty much won't work, because Python chases symlinks to set sys.prefix, which means that the site path gets set to the `true' location rather than the one with all the links. This means that Python won't...
8
3241
by: Alia Khouri | last post by:
If the cannonical way to install a python app is python setup.py install one would expect the following to uninstall it python setup.py uninstall However, distutils doesn't automatically take care of that for you.
7
2412
by: Erik Johnson | last post by:
I am trying to upgrade my Python installation. After downloading sources and building Python 2.3.4, I am unable to use the command history editing feature in the interactive interpreter (where the up-arrow would previously give you the last command line to edit, it now just prints "^[[A".) This is a feature I use often, and it kinda nullifies...
3
1673
by: J | last post by:
Hi everyone, I have created an App that embedds the python interpreter and I am now in the process of creating an installer. I am currently linking python24.lib, but it is only 184k and I suspect that it imports other dlls... I am also using numarray. Does anyone have any experiences in packaging python with an application in a single...
3
1696
by: Paul Mc Gee | last post by:
hi everyone i have just downloaded the latest version of postgresql and was doing the installation according to the article at http://www.faqs.org/docs/ppbook/x486.htm when i got to the point where the perl and python modules are to be installed. the distribution used in that article is an older version of postgresql and i cant seem to find...
34
3927
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH environment variable. Every time, I've had to go through and add this by hand, to have something resembling a usable Python installation. No such...
4
3444
by: Will Honea | last post by:
Wanting to look at V9, I attempted to install Db2 Express-C on a Suse Linux box I use as a sandbox. Since I was less that thorough when removing previous installations of V8 and V7, the installation failed creating the admin server. I now have a phantom instance that I can't access or drop so the de_install fails but the installation is...
0
1968
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open ( +4) / 291 closed ( +4) / 553 total ( +8) New / Reopened Patches ______________________
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.