2
votes

I recently installed Python3.7 from Python.org. Previously I had an installation via brew which I uninstalled because I just could not get some packages to work. Now, python3.7 is working but when I run brew doctor I get a warning message saying I should install python as it is a dependency for vim. Vim is working fine.

  1. Shall I ignore this warning? I would rather not and have everything nicely set up.
  2. Shall I install a third python version via brew? I would rather just stick to one I recently installed [+ the Apple supplied python2.7].
  3. So, is there a way to let brew know to use the existing python3.7 installation?

    $ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories. ./configure scripts often look for *-config scripts to determine if software packages are installed, and what additional flags to use when compiling and linking.

Having additional scripts in your path can confuse software installed via Homebrew if the config script overrides a system or Homebrew provided script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-config /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m-config /Library/Frameworks/Python.framework/Versions/3.7/bin/python3-config

Warning: Some installed formulae are missing dependencies. You should brew install the missing dependencies: brew install python

Run brew missing for more details.

$ brew missing
vim: python

$ brew --config 

ORIGIN: https://github.com/Homebrew/brew

HEAD:61ace27006a1cb444552c0be10087fcbc3051643

Last commit: 32 hours ago

Core tap ORIGIN: https://github.com/Homebrew/homebrew-core

Core tap HEAD: 1e49b74a54bebb907f95b57fb8f4b7b4b0f9a7bf

Core tap last commit: 4 hours ago

HOMEBREW_PREFIX: /usr/local

HOMEBREW_GIT: git CPU: quad-core 64-bit broadwell

Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby

Clang: 9.1 build 902

Git: 2.15.2 => /usr/bin/git

Curl: 7.54.0 => /usr/bin/curl

Java: N/A

macOS: 10.13.6-x86_64

CLT: 9.4.1.0.1.1528165917

Xcode: 9.4.1

XQuartz: 2.7.11 => /opt/X11

1

1 Answers

0
votes

It's advisable to setup a clean development environment so as to avoid potential drawbacks.

You shouldn't ignore the warning particularly when you have missing dependencies; this means that you have an application(s) that do not have the requisite to function as expected.

To use Homebrew to manage and install Python, proceed first by clearing the Python 3.7 you installed from Python.org by following the three steps below;

  1. Ensure you quit Python and close all Python processes running in the background; it is very important for so Python gets safely deleted.

    You may open Activity Monitor so as to double check and ensure the above condition is met.

  2. Through Finder, navigate to the Application folder and completely move the "Python 3.7" application to Trash.

    Alternatively, you may run sudo rm -rf "/Applications/Python 3.7" for the purpose above.

  3. Then, run sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.7 so as to remove all service files relating to your Python 3.7 instance from the Library folder.

Now that we have successfully cleared your previous Python 3.7 instance, exit your terminal, then, reopen it.

Next, check and ensure you have no duplicate Python installation through Homebrew.

Should you run brew list python and have Python successfully listed, do uninstall and reinstall Python by running the commands in the snippet below;

brew uninstall python
brew cleanup -s
brew install python

Otherwise simply proceed to install Python using Homebrew by running

brew install python

You may check your newly installed Python version by running python3 --version.

Should the command about fail with the error below,

-bash: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3: No such file or directory

Restart your computer then, proceed further with the walk though so Homebrew can reference your Python installation without any issue.


Bonus;

Should you want run your newly installed Python (version 3.x) in your terminal using python (pointing to the default Python chipped with Mac OS X, version 2.x) instead of python3, simply run the command line below to get that sorted;

alias python="python3"

You can now run your commands for Python version 3.x using python.