ipython in different loctions.

Cameron Simpson cs at cskk.id.au
Wed Oct 2 20:19:23 EDT 2019


On 02Oct2019 07:37, Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>I noticed that the ipython on my Debian box located in the following
>locations:
>
>werner at localhost:~$ ls .local/bin/ipython*
>.local/bin/ipython  .local/bin/ipython3
>
>werner at localhost:~$ ls .pyenv/shims/ipython*
>.pyenv/shims/ipython  .pyenv/shims/ipython3

I would guess that the former came from "pip install ipython" and that 
the latter came from an an environment set up with pyenv.

>And, they are different:
>
>--------
>werner at localhost:~$ diff .pyenv/shims/ipython3 .local/bin/ipython3
>1,3c1
>< #!/usr/bin/env bash

This is a small shell script wrapper, presumably hooking into your pyenv 
setup to find the "real" ipython.

>> from IPython import start_ipython
>> if __name__ == '__main__':
>>     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
>>     sys.exit(start_ipython())

This is the Python boilerplate wrapper with pip uses to install an 
ipython executable script in a bin directory.

You may find that the shell script from .pyenv/shims eventually executes 
a python script like the one from .local/bin. Try going:

  bash -x ~/.pyenv/shims/ipython3

and see what its final command does.

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



More information about the Python-list mailing list