Can't use Python after trying to install wget

Viewed 19

I was recently trying to download wget. Initially I had to update homebrew due to the fact that there was an apparent issue with homebrew and macOS Monterey. At the end of this update I got the following

HEAD is now at cb7f7598222 open-babel: fix `python3` reference.
Error: Could not link:
/usr/local/share/man/man1/brew.1

Please delete these paths and run:
  brew update
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run:
  brew update
==> Installation successful!

Because it said installation was successful, I ignored the error messages. After this, I tried installing wget via brew i.e brew install wget, only to get the following error

==> Pouring libevent--2.1.12.monterey.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/event_rpcgen.py
Target /usr/local/bin/event_rpcgen.py
is a symlink belonging to libevent. You can unlink it:
  brew unlink libevent

To force the link and overwrite all conflicting files:
  brew link --overwrite libevent

To list all files that would be deleted:
  brew link --overwrite --dry-run libevent

Possible conflicting files are:
/usr/local/bin/event_rpcgen.py -> /usr/local/Cellar/libevent/2.0.22/bin/event_rpcgen.py
/usr/local/include/evdns.h -> /usr/local/Cellar/libevent/2.0.22/include/evdns.h
/usr/local/include/event.h -> /usr/local/Cellar/libevent/2.0.22/include/event.h
Error: Could not symlink include/event2/buffer.h
Target /usr/local/include/event2/buffer.h
is a symlink belonging to libevent. You can unlink it:
  brew unlink libevent

To force the link and overwrite all conflicting files:
  brew link --overwrite libevent

To list all files that would be deleted:
  brew link --overwrite --dry-run libevent

I did not do anything after this and just left it as is. Then, I tried to run Python (version 3.5.1, which I have been using for the last 6 years and has always worked) and I got the following error

File "/usr/local/bin/ipython3", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.5/site-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-111>", line 2, in initialize
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/IPython/terminal/ipapp.py", line 297, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/IPython/core/application.py", line 401, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.5/site-packages/IPython/terminal/ipapp.py", line 292, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 514, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "/usr/local/lib/python3.5/site-packages/IPython/core/application.py", line 211, in initialize_subcommand
    return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 445, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/local/lib/python3.5/site-packages/ipython_genutils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
  File "/usr/local/lib/python3.5/site-packages/notebook/notebookapp.py", line 22, in <module>
    import ssl
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: dlopen(/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_ssl.cpython-35m-darwin.so, 0x0002): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_ssl.cpython-35m-darwin.so
  Reason: tried: '/usr/local/opt/openssl/lib/libssl.1.0.0.dylib' (no such file), '/usr/local/lib/libssl.1.0.0.dylib' (no such file), '/usr/lib/libssl.1.0.0.dylib' (no such file), '/usr/local/Cellar/openssl@3/3.0.5/lib/libssl.1.0.0.dylib' (no such file), '/usr/local/lib/libssl.1.0.0.dylib' (no such file), '/usr/lib/libssl.1.0.0.dylib' (no such file)

It seems that a file /usr/lib/libssl.1.0.0.dylib is now missing. I then downloaded Python 3.5.1 again from the website and reinstalled it, only to get the same error again.

Could anyone please explain what has happened and how to fix the problem?

0 Answers
Related