-
Install some core dependencies.
brew install curl libusb openssl@3 [email protected] brew link curl --force export PATH="$(brew --prefix curl)/bin:${PATH}"
-
Create a Python virtual environment and activate it. This will ensure everything is self-contained.
python3.9 -m venv .venv source .venv/bin/activate pip install --upgrade pip wheel
When you're inside of this activated virtual environment,
python
refers to the correct version of Python (3.9) andpip
is connected to this one Python installation. -
Edit
requirements.txt
to remove the version constraints onpycurl
.- pycurl~=7.44.1; sys_platform != 'win32' + pycurl; sys_platform != 'win32'
-
We will install dependencies from
requirements.txt
, but this will involve compiling a custom build ofpycurl
with OpenSSL. Just copy-paste and run the whole block below.PYCURL_SSL_LIBRARY=openssl \ LDFLAGS="-L$(brew --prefix openssl@3)/lib" \ CPPFLAGS="-I$(brew --prefix openssl@3)/include" \ pip install --no-cache-dir --compile --ignore-installed -r requirements.txt
-
Run the application.
python gui_nut.py
When you're done, you may choose to clean-up some things.
-
Running
deactivate
(or simply closing/quitting your terminal) will exit the Python virtual environment. -
Closing/quitting your terminal will revert the update to
$PATH
we did up at the top. -
Switch back to the built-in macOS
curl
by default.brew unlink curl
Once you've exited and cleaned-up (below) your Python virtual environment, but you choose to re-enter your Python virtual environment, then do:
-
Configure dependencies.
brew link curl --force export PATH="$(brew --prefix curl)/bin:${PATH}"
-
Re-activate the Python virtual environment.
source .venv/bin/activate