Open terminal,Enter the command line
sudo spctl --master-disable
After entering the password, click Enter (please note that the password is not visible when entering)
Tap the lock button to make changes
Under the Allow apps from download option, check any source