iPython installed but not found

后端 未结 6 1806
清酒与你
清酒与你 2020-12-05 12:53

I\'ve recently deleted Anaconda and reinstalled python with brew. I\'ve installed everything according to these instructions.

Python works great, and all packages I\

相关标签:
6条回答
  • 2020-12-05 13:28

    Searching the web for "bash: ipython: command not found" turns up several hits (including this SO question), but they're not particularly helpful. From the sound of it, you have IPython, the Python package installed, but ipython—the entry point (i.e., wrapper/launcher script) for it—is missing for whatever reason. To check whether this is the case, try running:

    % python -m IPython
    Python 2.7.9 (default, Feb 10 2015, 03:28:08) 
    Type "copyright", "credits" or "license" for more information.
    
    IPython 4.0.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]:
    

    If that brings up IPython, then you might try making a shell alias as the SO answer linked above suggests, i.e., put something like this in your shell's startup script: alias ipython='python -m IPython'. Or, create the launcher script yourself. For me, it lives in /usr/local/bin/ipython and contains the following:

    #!/usr/local/opt/python/bin/python2.7
    
    # -*- coding: utf-8 -*-
    import re
    import sys
    
    from IPython import start_ipython
    
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
        sys.exit(start_ipython())
    

    Hope this helps. (If it does, please consider up-voting the other SO question as well...)

    UPDATE: Here are some more possibly-relevant links:

    • ipython: command not found on OSX
    • https://github.com/pypa/pip/issues/426
    0 讨论(0)
  • 2020-12-05 13:34

    Sometimes you just need to source your bash_profile after you successfully installed anaconda.

    source ~/.bash_profile
    
    0 讨论(0)
  • 2020-12-05 13:38

    If working with Python3, just try:

    ipython3
    

    It worked for me.

    0 讨论(0)
  • 2020-12-05 13:39

    The above answers are probably sufficient, but I wanted to share my experience since I ran into this same problem today and discovered a simple solution. I installed ipython use apt in Ubuntu 18.04 as follows:

    sudo apt install python-ipython

    Then, the 'ipython' command didn't work and I got the same "Command not found" error mentioned above. The same happened after installed python3-python. However, then I tried 'sudo apt install ipython' and the correct wrappers were installed. I don't know if something similar happens with pip, but that is my experience with apt.

    0 讨论(0)
  • 2020-12-05 13:40

    What worked for me was to unistall using:

    ~pip3 uninstall ipython
    

    and then:

    ~sudo pip3 install ipython
    

    I'm running this on (W10)WSL2 with a Debian.

    0 讨论(0)
  • 2020-12-05 13:50

    The answer given by @evadeflow does the job, but there are several other packages installed with pip and it will be very uncomfortable to keep adding alias for each of them. A rather elegant way would be to add the path where these packages are installed to the $PATH variable. In my case adding the following line in ~/.bashrc did the job:

    export PATH=$PATH:/home/my_user_name/.local/bin
    

    Addl refs: https://askubuntu.com/q/551990/632996; https://askubuntu.com/q/556090

    0 讨论(0)
提交回复
热议问题