[Tutor] Installing python and numpy on the Mac (OSX)
giacomo.boffi at gmail.com
giacomo.boffi at gmail.com
Sat Jan 13 18:35:34 EST 2018
Peter Hodges <designx1000 at gmail.com> writes:
> Hi. I downloaded Python 3.6 from the python site, then followed online
> directions for pip to install numpy (in users? —user was in the
> example).
> When I start IDLE in the Python 3.6 in Applications and then type
> import numpy as np I get the following:
> import numpy as np
> Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> import numpy as np
> ModuleNotFoundError: No module named ‘numpy'
>
> Does this mean I need to set the $PATH with some new pathname?
no
> Or move the numpy directory into the python 3.6 directory?
no
> Or?
----
first, (optional but I'd reccommend to) disinstall numpy using the same
pip script that you used to install it, something like
$ pip uninstall numpy # possibly using sudo
----
next, you must be sure that Python 3.6 has pip, either
$ /path/to/python3.6 -m ensurepip --user
or (if you are installing in a virtual environment)
$ /path/to/python3.6 -m ensurepip
the above is going to install pip if it is not already present in the
environment of Python 3.6 --- please see
https://docs.python.org/3/library/ensurepip.html
for the gory details
----
finally, install numpy for 3.6
$ /path/to/python3.6 -m pip install --user numpy
----
The command "/path/to/python3.6 -m modulename ..." ensures that the
module and the Python version are matching one with the other.
More information about the Tutor
mailing list