Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'interpreter': 0.15; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:when': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; 'windows': 0.20; 'lawrence': 0.22; 'bit': 0.23; 'module': 0.23; 'import': 0.24; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'command': 0.28; "skip:' 70": 0.29; 'work.': 0.30; 'language.': 0.32; 'this?': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'set.': 0.35; 'something': 0.35; 'skip:o 20': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'instead': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'mark': 0.40; 'our': 0.64; 'cecil': 0.84; 'pythonistas,': 0.84; 'westerhof': 0.84; '\xe2\x80\xa6': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: PYTHONPATH when calling from ipython Date: Sat, 23 May 2015 10:12:30 +0100 References: <874mn5qjc8.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-92-18-27-35.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <874mn5qjc8.fsf@Equus.decebal.nl> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432372378 news.xs4all.nl 2926 [2001:888:2000:d::a6]:60957 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91108 On 22/05/2015 06:20, Cecil Westerhof wrote: > I am looking into using ipython instead of bash. But when I call a > python program from ipython PYTHONPATH is not set. So pythonscripts > that need a module through PYTHONPATH will not work. > > I could do something like: > !PYTHONPATH=~/Python/PythonLibrary python2 … > > But I find that a little bit cumbersome. Is there a better way to do > it? > What makes you think this? Have you tried:- >>> import os >>> os.environ['PYTHONPATH'] 'C:\\Users\\Mark\\Documents\\Cash\\Python;C:\\Users\\Mark\\Documents\\MyPython' That might be from the command line interpreter but it also works the same from iPython for me on Windows 8.1. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence