Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: CFK Newsgroups: comp.lang.python Subject: Re: Python environment on mac Date: Tue, 26 Jul 2016 11:38:00 -0400 Lines: 46 Message-ID: References: <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de eFi8T2iLYrL8c55kNwk4egsPo2EjlyHU87c7QuWOp44Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'subject:Python': 0.05; 'used.': 0.05; 'root,': 0.07; 'skip:/ 10': 0.07; 'cc:addr:python-list': 0.09; 'lost.': 0.09; 'example:': 0.10; 'python': 0.10; 'variables': 0.15; '->': 0.16; '2016': 0.16; 'correctly,': 0.16; 'executables': 0.16; 'pep8': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set;': 0.16; 'skip:p 90': 0.16; 'stripped': 0.16; 'structure.': 0.16; 'sudo': 0.16; 'trustful': 0.16; 'using,': 0.16; 'wrote:': 0.16; "shouldn't": 0.18; '(in': 0.18; 'email addr:gmail.com>': 0.18; 'variable': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'thanks,': 0.24; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'install': 0.25; 'installed': 0.26; 'message-id:@mail.gmail.com': 0.27; 'way?': 0.29; 'environment': 0.29; 'admin': 0.29; 'url:mailman': 0.30; 'run': 0.33; 'url:python': 0.33; 'skip:/ 20': 0.33; 'utility': 0.33; 'url:listinfo': 0.34; 'changing': 0.34; 'structure': 0.34; 'received:google.com': 0.35; 'clear': 0.35; 'path': 0.35; 'set.': 0.35; 'quite': 0.35; 'problem.': 0.35; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'url:org': 0.36; '(and': 0.36; 'modules': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'say': 0.37; 'environment.': 0.37; 'mac': 0.37; 'things': 0.38; 'version': 0.38; 'anything': 0.38; 'means': 0.39; "didn't": 0.39; 'enough': 0.39; 'url:mail': 0.40; 'well.': 0.40; 'where': 0.40; 'your': 0.60; 'different': 0.63; 'profile': 0.63; '26,': 0.72; 'jul': 0.72; 'account!': 0.84; 'are?': 0.84; 'pip': 0.84; 'alone.': 0.91; 'careful': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=WGwCp3hWGydmNNH0fC0RDflh+yBxnsWwZQQFakCLRww=; b=LkwVz0UAY5do9wJ0UXLo47rYUQQUvHDoUbr8NTmgOKe9QDzrY4n7HZnuFvL6C2GwGt vVVi8fKYQh9rsqQwsoU+DW4sZ2Ze0j7yM19wJtUhzN6JEAFCMXbIAQAMhuSsSonXASe+ 36HIhwjO8DWK6WhgnYDnuPySEwNHutZM0D/+2aWvAAojUHRdlOTQZOBcA/ywMMW1yOUe y7CfXDBNgz+L3d7fyGye7TcQKHBPpauF+i+sGTLESgdV31eCRrBnLKPA0/8BIyHo198C eX/ZWeNoYKv2uLnFq7Ld9u4tysMUDs89qfAQMEgeDTTJmeBcIVIWycj1dI6VVYohQDDE nztQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=WGwCp3hWGydmNNH0fC0RDflh+yBxnsWwZQQFakCLRww=; b=lDD8zjC62KveVRi1QdU7YSlEO7YFOHPsWIjG9En6QQCFP0MwEACYcaK6cxCSHtdXom 8KXVhzfQLrUixvHpF++hhR309gv6hu21ewbZHh6eIjOFqWDxWogekLKyNi8DNcITg+E4 Ipybg4BTTaeIvS1AVlWKsBPVlbHKnPNqw7NQiLlzvDoZMY7qTglDtP0EwGw/rt+0GwXr ACTlpOxl2ZgbkcJ7Nvend682kMDb95o4Tn65bb8kMRYk3HSJQGA94agb8/4V3D54+Fzg t6oLKrfXnLW+CrWCH+N51I/nntWT2/gUG747iXofgHcV3ZsLPj8xR9UhYLAOzoIq9G9h xVeQ== X-Gm-Message-State: AEkoouvlR3ED5hSCPr0G7TlzuvFev+vJwz19B1EjQLexkmeh+ehOyJcma4386sND5GXgx7dcZQTQDu+J3V0WUw== X-Received: by 10.200.54.185 with SMTP id a54mr40666492qtc.63.1469547480874; Tue, 26 Jul 2016 08:38:00 -0700 (PDT) In-Reply-To: <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> Xref: csiph.com comp.lang.python:111898 There are two variables you will need to set; PATH and PYTHONPATH. You set your PYTHONPATH correctly, but for executables like pip, you need to set the PATH as well. You MUST do that for each account! The reason it didn't work as root is because once you su to root, it replaces your PYTHONPATH and PATH (and all other environment variables) with root's. sudo shouldn't have that problem. BE VERY CAREFUL CHANGING THESE VARIABLES FOR ROOT! I managed to wedge a system until I reverted my environment. Thanks, Cem Karan On Jul 26, 2016 9:58 AM, "Crane Ugly" wrote: > Mac OS X comes with its own version of python and structure to support it. > So far it was good enough for me. Then I started to use modules that > distributed through MacPorts and this is where I get lost. > I do not quite understand how Python environment is set. Or how to set it > in a way of using, say MacPorts distribution alone. > For example: standard location for pip utility is /usr/local/bin/pip. > MacPorts structure has it too but as a link > lrwxr-xr-x 1 root admin 67 May 23 22:32 /opt/local/bin/pip-2.7 -> > /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pip > Which means that the standard utility will be used. > The things is that depending on a way I run pip I get different results: > $ pip list|grep pep8 > pep8 (1.7.0) > $ sudo pip list|grep pep8 > $ > pep8 was installed through macports. > In second case pip is using stripped environment and pointing to standard > Mac OS Python repository. > But in a way to install anything with pip I have to use sudo. > In my profile I have variable PYTHONPATH: > > PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages > It is pointing to macports structure. But when I use sudo (in case of > using pip) it get stripped. > How to setup and maintain python environment in a trustful way? So it is > clear where all installed modules are? > > Leonid > -- > https://mail.python.org/mailman/listinfo/python-list >