conflict between multiple installs of python (linux)

Discussion in 'Python' started by david, Jul 5, 2008.

  1. david

    david Guest

    You learn something new every day:

    On my ubuntu, update-manager is supposed to use the python2.5
    installed on /usr/bin. Well, I had subsequently installed a whole
    bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
    python2.5 etc), which I have happily been using for development for a
    year. I had thought that the two pythons were completely independent.

    Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it
    adds /usr/local/lib/python2.5 to its sys path - and apparently there
    are things in /usr/local which are inconsistent with those at /usr
    (not suprising).

    I have fixed the problem - but I had to modify the actual update-
    manager .py file itself. At the beginning, I set the sys.path in
    python *explicitly* to not include the /usr/local stuff.

    But this is clearly a kludge. My question: how do I keep the Ubuntu
    python stuff at /usr/bin/python2.5 from adding /usr/local/lib/
    python2.5 to the import search path in a clean and global way? I
    really want both pythons completely isolated from one another!

    Thankyou.
     
    david, Jul 5, 2008
    #1
    1. Advertising

  2. david

    casevh Guest

    On Jul 5, 11:09 am, david <> wrote:
    > You learn something new every day:
    >
    > On my ubuntu, update-manager is supposed to use the python2.5
    > installed on /usr/bin. Well, I had subsequently installed a whole
    > bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
    > python2.5 etc), which I have happily been using for development for a
    > year. I had thought that the two pythons were completely independent.
    >
    > Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it
    > adds /usr/local/lib/python2.5 to its sys path - and apparently there
    > are things in /usr/local which are inconsistent with those at /usr
    > (not suprising).
    >
    > I have fixed the problem - but I had to modify the actual update-
    > manager .py file itself. At the beginning, I set the sys.path in
    > python *explicitly* to not include the /usr/local stuff.
    >
    > But this is clearly a kludge. My question: how do I keep the Ubuntu
    > python stuff at /usr/bin/python2.5 from adding /usr/local/lib/
    > python2.5 to the import search path in a clean and global way? I
    > really want both pythons completely isolated from one another!
    >
    > Thankyou.


    Python's path is build by site.py. In the file /usr/lib/python2.5/
    site.py, look for the line "prefixes.insert(0, '/usr/local')" and
    comment it out. That should do it.

    casevh
     
    casevh, Jul 5, 2008
    #2
    1. Advertising

  3. david

    Guest

    Is some problems with 2.5 i see something on internet (ex: ctypes )
    So i try to install 2.5.1 for pyglet1.1, but not work with ctypes .
    So ctypes lib is on the path lib's !?
    But python2.6 work with ctypes.
    The python2.5 and 2.6 have been installed with same command:
    python setup.py install
    If you see my code :

    python2.5
    Python 2.5.1 (r251:54863, Jul 4 2008, 14:55:17)
    [GCC 4.3.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ctypes

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python2.5/ctypes/__init__.py", line 10, in
    <module>
    from _ctypes import Union, Structure, Array
    ImportError: No module named _ctypes
    >>> import pyglet

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python2.5/site-packages/pyglet/__init__.py",
    line 69, in <module>
    _require_ctypes_version('1.0.0')
    File "/usr/local/lib/python2.5/site-packages/pyglet/__init__.py",
    line 64, in _require_ctypes_version
    import ctypes
    File "/usr/local/lib/python2.5/ctypes/__init__.py", line 10, in
    <module>
    from _ctypes import Union, Structure, Array
    ImportError: No module named _ctypes
    >>>


    python (default python )
    Python 2.6b1 (r26b1:64398, Jul 4 2008, 15:57:20)
    [GCC 4.3.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ctypes
    >>> import pyglet
    >>> print pyglet.version

    1.1beta2
    >>>



    Try python 2.6
    To see the path this is some code:

    import sys
    print sys.path
    print sys.prefix
    print sys.prefix

    Have a nice day !

    On Jul 5, 10:04 pm, casevh <> wrote:
    > On Jul 5, 11:09 am, david <> wrote:
    >
    >
    >
    > > You learn something new every day:

    >
    > > On my ubuntu, update-manager is supposed to use the python2.5
    > > installed on /usr/bin. Well, I had subsequently installed a whole
    > > bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
    > > python2.5 etc), which I have happily been using for development for a
    > > year. I had thought that the two pythons were completely independent.

    >
    > > Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it
    > > adds /usr/local/lib/python2.5 to its sys path - and apparently there
    > > are things in /usr/local which are inconsistent with those at /usr
    > > (not suprising).

    >
    > > I have fixed the problem - but I had to modify the actual update-
    > > manager .py file itself. At the beginning, I set the sys.path in
    > > python *explicitly* to not include the /usr/local stuff.

    >
    > > But this is clearly a kludge. My question: how do I keep the Ubuntu
    > > python stuff at /usr/bin/python2.5 from adding /usr/local/lib/
    > > python2.5 to the import search path in a clean and global way? I
    > > really want both pythons completely isolated from one another!

    >
    > > Thankyou.

    >
    > Python's path is build by site.py. In the file /usr/lib/python2.5/
    > site.py, look for the line "prefixes.insert(0, '/usr/local')" and
    > comment it out. That should do it.
    >
    > casevh
     
    , Jul 6, 2008
    #3
  4. david

    Zentrader Guest

    On Jul 5, 11:09 am, david <> wrote:
    > You learn something new every day:
    >
    > On my ubuntu, update-manager is supposed to use the python2.5
    > installed on /usr/bin. Well, I had subsequently installed a whole
    > bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
    > python2.5 etc), which I have happily been using for development for a
    > year. I had thought that the two pythons were completely independent.
    >
    > Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it
    > adds /usr/local/lib/python2.5 to its sys path - and apparently there
    > are things in /usr/local which are inconsistent with those at /usr
    > (not suprising).
    >
    > I have fixed the problem - but I had to modify the actual update-
    > manager .py file itself. At the beginning, I set the sys.path in
    > python *explicitly* to not include the /usr/local stuff.
    >
    > But this is clearly a kludge. My question: how do I keep the Ubuntu
    > python stuff at /usr/bin/python2.5 from adding /usr/local/lib/
    > python2.5 to the import search path in a clean and global way? I
    > really want both pythons completely isolated from one another!
    >
    > Thankyou.


    When you install a second version, let us say Python3.0, you want to
    download the source and do the normal config and make but not make
    install. Instead do a make altinstall. They will be kept separate.
    I have Ubuntu's 2.5 as well as 3.0. Ubuntu installs to /usr/bin and /
    usr/lib, so I installed 3.0 from /usr/local/Python-3.0 and those files
    installed into /usr/local/bin and lib and the executable is
    python3.0. Take a look at the README file that comes with the source
    code for other options.
     
    Zentrader, Jul 8, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    383
    Abrasive Sponge
    Mar 5, 2005
  2. Brad Tilley

    Automate Python-2.4 Installs on Windows

    Brad Tilley, Dec 13, 2004, in forum: Python
    Replies:
    5
    Views:
    343
    Fredrik Lundh
    Dec 14, 2004
  3. charles cashion

    css conflict (or html conflict)

    charles cashion, Feb 18, 2009, in forum: HTML
    Replies:
    2
    Views:
    821
    charles cashion
    Feb 18, 2009
  4. Johnny Ruin

    multiple installs of the same webservice?

    Johnny Ruin, Mar 6, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    147
    Johnny Ruin
    Mar 6, 2006
  5. Seth Brundle

    Using CPAN.pm with multiple perl installs

    Seth Brundle, Sep 21, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    105
    Seth Brundle
    Sep 21, 2005
Loading...

Share This Page