AFAIK pipx only puts the executables in your
PATH. It doesn't put python modules in your
PYTHONPATH. If you want that, you'll need to also add the relevant modules to your system
PYTHONPATH. But then you'd just be ignoring the point of why pipx exists and you may as well just install the module using
pip install --break-system-packages as you'll get the same end result: a mix of apt managed packages and pip managed packages which often leads to things breaking in weird and unexpected ways.
For scripting purposes, just use a venv. It's not that hard and will save you a ton of potential issues down the track. I.e. try something like this:
Code: Select all
user@ninjux projects/debian-playing$ python3 -m venv my-project
user@ninjux projects/debian-playing$ ./my-project/bin/pip install binance-connector
Collecting binance-connector
Downloading binance_connector-3.5.1-py3-none-any.whl (71 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.9/71.9 kB 1.1 MB/s eta 0:00:00
Collecting requests>=2.31.0
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 4.2 MB/s eta 0:00:00
Collecting websocket-client>=1.6.3
Downloading websocket_client-1.7.0-py3-none-any.whl (58 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.5/58.5 kB 6.2 MB/s eta 0:00:00
Collecting pycryptodome>=3.15.0
Downloading pycryptodome-3.19.1-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 2.9 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3/140.3 kB 2.8 MB/s eta 0:00:00
Collecting idna<4,>=2.5
Downloading idna-3.6-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 5.1 MB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.1.0-py3-none-any.whl (104 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.6/104.6 kB 4.1 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 kB 3.0 MB/s eta 0:00:00
Installing collected packages: websocket-client, urllib3, pycryptodome, idna, charset-normalizer, certifi, requests, binance-connector
Successfully installed binance-connector-3.5.1 certifi-2023.11.17 charset-normalizer-3.3.2 idna-3.6 pycryptodome-3.19.1 requests-2.31.0 urllib3-2.1.0 websocket-client-1.7.0
user@ninjux projects/debian-playing$ ./my-project/bin/python --version
Python 3.11.2
user@ninjux projects/debian-playing$ ./my-project/bin/python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from binance.spot import Spot
>>>
So long as you use that venv python path in the shebang of any scripts you write, then they should "just work". Although be sure to use the absolute path, I was only demonstrating the theory with a relative path. Note that then running your script on a different machine might be a bit of a PITA. So if you intend to do anything more than write a few dirty scripts to run locally, I'd suggest a "proper" python project dependency manager, such as
poetry.