Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
install issue
#1
I downloaded the macosx version 3.6.4 and installed it by clicking the donwn-loaded pkg . However when I run a simple script that worked with 2.7 it fails importing import matplotlib and numpy with "ModuleNotFoundError" error. What else is necessary for the install to find the packages.
Reply
#2
Doing it Right
Quote:python3 will launch the homebrew-installed Python 3 interpreter.
Homebrew version of Python 3 is installed then pip will point to Python 3.
gmeyers Wrote:However when I run a simple script that worked with 2.7 it fails importing import matplotlib and numpy with "ModuleNotFoundError" error. What else is necessary for the install to find the packages.
You most pip install into Python 3.
Check that pip or pip3 point to python 3.
mint@mint ~ $ pip -V
mint@mint ~ $ pip3 -V

# Install
pip install numpy
pip install -U matplotlib

Alternative pyenv is the best version management to use,
and safe it do not mess with system Python installation.
Examle Linux,work the same on Mac.
# Install
mint@mint ~ $ pyenv install 3.6.4
Downloading Python-3.6.4.tar.xz...
-> https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
Installing Python-3.6.4...
Installed Python-3.6.4 to /home/mint/.pyenv/versions/3.6.4

# Set python and pip to point to 3.6.4
mint@mint ~ $ pyenv global 3.6.4
mint@mint ~ $ python -V
Python 3.6.4
mint@mint ~ $ pip -V
pip 9.0.1 from /home/mint/.pyenv/versions/3.6.4/lib/python3.6/site-packages (python 3.6)
# Finish
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020