Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111919
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Python environment on mac |
| Date | Wed, 27 Jul 2016 10:58:28 +1000 |
| Lines | 40 |
| Message-ID | <mailman.3.1469582490.10276.python-list@python.org> (permalink) |
| References | <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> <20160727005828.GA99643@cskk.homeip.net> |
| Reply-To | python-list@python.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| X-Trace | news.uni-berlin.de U659z0Co2kXMgE3g3IPC5wE6ksrMFwGDJXkw42oJUb4Q== |
| Return-Path | <cameron@cskk.homeip.net> |
| 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; 'executable': 0.07; 'skip:/ 10': 0.07; 'ugly': 0.07; 'cc:addr:python-list': 0.09; 'based.': 0.09; 'lost.': 0.09; 'example:': 0.10; 'python': 0.10; 'appropriate': 0.14; '/usr/local.': 0.16; '>in': 0.16; 'executables': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'pep8': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:io': 0.16; 'received:optusnet.com.au': 0.16; 'received:psf.io': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'stripped': 0.16; 'structure.': 0.16; 'sudo': 0.16; 'trustful': 0.16; 'using,': 0.16; 'virtualenv.': 0.16; 'wrote:': 0.16; '(in': 0.18; 'variable': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cheers,': 0.22; 'cc:no real name:2**0': 0.22; '(or': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'install': 0.25; 'header:User-Agent:1': 0.26; 'installed': 0.26; 'executing': 0.27; 'invoke': 0.29; 'way?': 0.29; 'environment': 0.29; 'admin': 0.29; 'themselves': 0.29; 'run': 0.33; 'adjust': 0.33; 'received:com.au': 0.33; 'skip:/ 20': 0.33; 'utility': 0.33; 'correctly': 0.34; 'structure': 0.34; 'could': 0.35; 'clear': 0.35; 'set.': 0.35; 'quite': 0.35; 'but': 0.36; 'too': 0.36; 'modules': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'environment.': 0.37; 'mac': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'no,': 0.38; 'version': 0.38; 'anything': 0.38; 'means': 0.39; 'enough': 0.39; 'build': 0.40; 'where': 0.40; 'your': 0.60; 'avoid': 0.61; 'needing': 0.63; 'personal': 0.63; 'different': 0.63; 'complete': 0.63; 'profile': 0.63; 'you.': 0.64; 'cameron': 0.66; 'note:': 0.66; 'header:Reply-To:1': 0.67; 'therefore': 0.67; 'reply-to:no real name:2**0': 0.71; 'yourself,': 0.72; 'hand': 0.82; '>how': 0.84; 'are?': 0.84; 'crane': 0.84; 'pip': 0.84; 'reply-to:addr:python.org': 0.84; 'alone.': 0.91; 'habit': 0.91 |
| Content-Disposition | inline |
| In-Reply-To | <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=OtmysHLt c=1 sm=1 tr=0 a=kPLexIa+XrsL4mdc8kxeNA==:117 a=kPLexIa+XrsL4mdc8kxeNA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=cAmyUtKerLwA:10 a=pGLkceISAAAA:8 a=vrnE16BAAAAA:8 a=bewQqQVlyKslObIPPB0A:9 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22 a=D4O83h6meWPcCEhhlUO6: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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <20160727005828.GA99643@cskk.homeip.net> |
| X-Mailman-Original-References | <950a22b5-6b34-4f99-8312-94972cb372da@googlegroups.com> |
| Xref | csiph.com comp.lang.python:111919 |
Show key headers only | View raw
On 26Jul2016 06:52, Crane Ugly <vostrushka@gmail.com> 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.
No, I think that means it uses the MacPorts one. Note: /opt/local vs
/usr/local.
>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?
My personal habit is to use virtualenv. You could build a virtualenv based of
the system Python or the MacPorts one (or make one of each). Then you can use
pip (as yourself, no sudo - avoid that if possible) from the appropriate
environment to install into that environment. Complete separation, and complete
control for you.
The executables inside a virtualenv ("python", "pip" etc) are stubs that adjust
PYTHONPATH etc themselves and then invoke the python one which that particular
virtualenv was based. This means that by executing that _specific_ executable
you automatically and correctly use that specific virtualenv. Without having to
hand maintain your own $PYTHONPATH, and therefore with needing to adjust it
depending which setup you want to use.
Cheers,
Cameron Simpson <cs@zip.com.au>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python environment on mac Crane Ugly <vostrushka@gmail.com> - 2016-07-26 06:52 -0700
Re: Python environment on mac CFK <cfkaran2@gmail.com> - 2016-07-26 11:38 -0400
Re: Python environment on mac Cameron Simpson <cs@zip.com.au> - 2016-07-27 10:58 +1000
Re: Python environment on mac Crane Ugly <vostrushka@gmail.com> - 2016-07-27 06:09 -0700
csiph-web