473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1359
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 "installationless".
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
It's possible to work with php just with these single file? Maybe I'm
doing the wrong thing, because to start to program I needed to install
a web server too (a large bunch of files). Also I've been looking into
http://www.modpython.org/, which appears to be a modular kind of python
with less than 400kb.

Thanks,
Xabier.

May 10 '06 #11
No! mod_python needs Python. It is simply an integration module for
Apache and Python, not an interpreter.

May 10 '06 #12
XBello wrote:
It's possible to work with php just with these single file? Maybe I'm
doing the wrong thing, because to start to program I needed to install
a web server too (a large bunch of files).


PHP can be run from the command line too. On ubuntu/debian it's available
by installing the php4-cli package. Not sure about other systems, I didn't
see any any obvious links on the php website.

May 10 '06 #13
Jack wrote:
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.
PHP has LOTS of functions in a single namespace. I don't know wether
they are in separate files or packed in the exexutable but I'm sure
that you don't need them all ;)
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.


Python is faster than PHP in most situations (2-3x). Look at
http://dada.perl.it/shooutout for win32 and
http://shooutout.alioth.debian.org for linux.

Peter Maas, Aachen
May 10 '06 #14
Ravi Teja wrote:
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.


Python also supports "frozen" modules, where the module bytecode is
linked into a Python interpreter as data. by combining frozen modules
and static linking of extension modules, it's relatively easy to create a
single-file python interpreter.

and to make things even simpler, you can get tools and ready-made
single-file distributions for a variety of platforms here:

http://www.egenix.com/files/python/mxCGIPython.html
http://phd.pp.ru/Software/Python/misc/mxCGI/

</F>

May 12 '06 #15

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

Similar topics

11
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...
1
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...
8
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...
7
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...
3
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...
3
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...
34
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...
4
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.