'MacPorts- port: command not found?

I am a beginning programmer playing around with making fractal music in python. I am thinking of using the mingus module to play the notes, however mingus need to have fluidsynth installed. I am trying to install fluidsynth using MacPorts. I have the fluidsynth files. When i run

sudo port install fluidsynth 

on my Mac terminal it asks for my password, which i enter. It then says

sudo: port: command not found"

What is going wrong? I am on a macOs mojave, if that helps.



Solution 1:[1]

I suspect that you may have not installed MacPorts correctly. Follow the MacPorts documentation to install it correctly. Once installed, you can run a command like

port installed

to list all of your ports.

If that worked then you can do this

source ~/.bash_profile

and it should work. See more possible solutions from here

Solution 2:[2]

as @Ila says here:

After lots of .bash_profile investigation, it turned out I just needed to reboot the terminal after installing MacPorts.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AzyCrw4282
Solution 2 Hila Grossbard