Pretty much self explanatry, where are Python modules stored in Linux?
(i.e. in /usr/bin/local, or where?) 12 22454
/usr/lib/python2.4/site-packages ?
No, not there
-- /usr/bin/byte
Byte wrote: Pretty much self explanatry, where are Python modules stored in Linux? (i.e. in /usr/bin/local, or where?)
Depends on how you installed Python (or how your distro package system
installed it). But it's usually in $PREFIX/lib/pythonX.X , with $PREFIX
being one of /usr or /usr/local (third-part modules being in the
site-packages subdirectory).
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
"Byte" wrote: Pretty much self explanatry, where are Python modules stored in Linux? (i.e. in /usr/bin/local, or where?)
it depends on how and where Python is installed. to see where they
are on your install, use
$ python -c "import sys; print sys.path"
['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2',
'/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages', ...
to check where a given module is installed, you can do
$ python -c "import cgi; print cgi.__file__"
/usr/lib/python2.4/cgi.pyc
hope this helps!
</F>
martin@jordaan:~$ python
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
They are in one of the directories listed in sys.path, for me this is:
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information. import sys print sys.path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
'/usr/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages/HTMLgen',
'/usr/lib/python2.4/site-packages/Numeric',
'/usr/lib/python2.4/site-packages/PIL',
'/usr/lib/python2.4/site-packages/cairo',
'/usr/lib/python2.4/site-packages/gtk-2.0']
see http://docs.python.org/lib/module-sys.html
Byte wrote: No, not there
Sure:
martin@mira:~$ ls /usr/lib/python2.4/site-packages
apt debconf.py Numeric pygtk.py
README
apt_inst.so debconf.pyc Numeric.pth pygtk.pyc
setuptools-0.6a8-py2.4.egg
apt_pkg.so easy-install.pth ORBit.la pygtk.pyo
setuptools.pth
cairo FormEncode-0.4-py2.4.egg ORBit.so pygtk.py.python2.4-gtk2
cairo.pth gtk-2.0 pygtk.pth python-support.pth
You mean, on *your* Linux? Give me an SSH account to your machine,
and I find out for you.
Regards,
Martin
Found it in /usr/local/lib/python2.4/site-packages, thanks. Now, how do
i convert a .py program into a module?
-- /usr/bin/byte
"Byte" <eo********@gmail.com> wrote: Found it in /usr/local/lib/python2.4/site-packages, thanks. Now, how do i convert a .py program into a module?
a .py program is a module (the module's content is what's left when the
program is finished).
to make a useful module, just make sure that it defines all the stuff you
want to make available (functions, classes, constants, etc), and that it
doesn't have any unexpected side-effects.
to create a script that can be used both as a script and as a module, you
can check the __name__ variable. see: http://diveintopython.org/getting_to...g_modules.html
for more on this.
</F>
LOL
a .py program is a module, you can import it:
if it is in the sys.path (import modulename).
if it sits in a directory that is in the sys.path and the directory
also has a __init__.py file (import dirname.modulename / from dirname
import modulname).
if there is a modulename.pth file in the sys.path containing the path
to your .py file.
(the current dir is always in the sys.path).
if you want to install your module (copy it under the site-packages
dir), then you should use distutils module and create a setup.py script
the compiled bytecode (.pyc file) is always automatically generated
Byte: where are Python modules stored in Linux?
Where are eggs laid on the western hemisphere?
--
René Pijlman
>if it is in the sys.path
sys.path, what is this?
Byte wrote: if it is in the sys.path
sys.path, what is this?
a variable in the sys module. quoting from a reply that you might have
missed:
$ python -c "import sys; print sys.path"
['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2',
'/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages', ...
</F> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO...
|
by: Berthold Hoellmann |
last post by:
Hello,
When I use
./configure --with-thread --with-fpectl --with-signal-module \
--with-pymalloc --enable-shared --with-cxx=g++
make test
on 2.3.3 I get
|
by: Olaf Meyer |
last post by:
I'm having some problems compiling Python 2.3.3 on HP-UX (B.11.00).
I've tried sevral different options for the configure script (e.g.
enabling/disabling gcc, aCC) but I always get the same problem...
|
by: Jerald |
last post by:
Running python 2.3.4 on valgrind (a tool like purify which checks
the use of uninitialized memory, etc), gives a lot of errors.
See below.
jfj@cluster:~/> python -V
Python 2.3.4...
|
by: Justin Johnson |
last post by:
Hello,
I'm trying to build Python 2.5.0 on AIX 5.3 using IBM's compiler
(VisualAge C++ Professional / C for AIX Compiler, Version 6). I run
configure and make, but makes fails with undefined...
|
by: emallove |
last post by:
I'm running into the below "No modules named _sha256" issue, with a
python installed in a non-standard location.
$ python
Python 2.5.2 (r252:60911, May 20 2008, 09:46:50)
on linux2
Type...
|
by: mg |
last post by:
When make gets to the _ctypes section, I am getting the following in
my output:
building '_ctypes' extension
creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/
Modules/_ctypes...
|
by: Akira Kitada |
last post by:
Hi list,
I was trying to build Python 2.6 on FreeBSD 4.11 and found it failed
to build some of the modules.
"""
Failed to find the necessary bits to build these modules:
_bsddb ...
|
by: Akira Kitada |
last post by:
Hi Marc-Andre,
Thanks for the suggestion.
I opened a ticket for this issue: http://bugs.python.org/issue4204
Now I understand the state of the multiprocessing module,
but it's too bad to see...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |