ipython in different loctions.

Cameron Simpson cs at cskk.id.au
Sat Oct 5 21:07:21 EDT 2019


On 03Oct2019 00:45, Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>On Thu, 03 Oct 2019 10:19:23 +1000, Cameron Simpson wrote:
>>   bash -x ~/.pyenv/shims/ipython3
>> and see what its final command does.
>
>Tried as follows:
>
>-----------------
>werner at localhost:~$ bash -x ~/.pyenv/shims/ipython3
[...]
>+ exec /home/werner/.pyenv/libexec/pyenv exec ipython3
>Python 3.7.4 (default, Aug 29 2019, 06:59:32)
[...]
>In [1]:
>-----------------
>
>Also tried the follows:
>werner at localhost:~$ bash -x ~/.local/bin/ipython3
>+ import re
>+ import sys
>+ from IPython import start_ipython
>from: can't read /var/mail/IPython
>/home/werner/.local/bin/ipython3: line 10: syntax error near unexpected
>token `('
>/home/werner/.local/bin/ipython3: line 10: `    sys.argv[0] = re.sub(r'(-
>script\.pyw?|\.exe)?$', '', sys.argv[0])'
>werner at localhost:~$
>
>The former can start the ipython, while the latter will fail.

That is because ~/.local/bin/ipython3 is not a shell script (thus syntax 
errors). It is directly a python script.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list