As shown in the following snippets - the paths point for python
and ipython
seem to all point to 3.x
- however the result is launching 2.x
. I am on macos High Sierra
Any thoughts?
Which python
are we using (3.X):
which python /usr/local/bin/python
$python --version Python 3.6.4
Which python
is ipython
pointing to (3.X ?)
cat $(which ipython) #!/usr/local/bin/python 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())
So let's run ipython
- and then which python
version is launched ( 2 .X ??):
$ipython Python 2.7.15 (default, Jun 26 2018, 09:40:54) Type "copyright", "credits" or "license" for more information.
IPython 5.5.0 -- An enhanced Interactive Python.
Update There was a comment about ipython3
: I had looked into that as well before posting. After running
pip3 install ipython
the results were Requirement already satisfied
for all dependencies. Afterwards however ipython3
still does not appear in the $PATH
.
You either need to change the PATH or use a virtual environment.
If you do not want to use conda you can use virtualenv.
You can install this with $ pip install virtualenv
. Make sure you install it for the right Python version.
After that you can create a virtual environment by creating a folder and then executing python3 -m venv env
You activate the environment in your shell / console with the source env/bin/activate
command.
If the command is successful your shell will show the environment in brackets.
Every virtual environment will have it's own set of packages but packages that you installed globally will be available when you built the environment.
This will work under Linux and Windows. Keep in mind that Windows does not have a shell.
Here is a full primer .
While the following is not - by far - an optimal solution it is a workaround for now:
alias ipython3='python3 -m IPython'
Multiple questions from the OP still remain as to why the various PATH
elements are not working as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.