0

I installed twine using the user flag (user scheme, according to the documentation):

pip install --user twine

But I can't use it as a command. For e.g. if I do:

twine --version

It gives me (this is obvious):

-bash: twine: command not found

I read this similar post, but could not find any satisfactory answer (answer is not accepted).

I know I can use:

python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

According to one of the answers.

But, my question is why it doesn't show up?

I checked the twine setup.py and found that it using the entry_points (which helps in setting the twine command). In my assumption, the setup.py is being ignored as it pip using wheel and not sdist during the installation (or to download the package).

Zoe
  • 27,060
  • 21
  • 118
  • 148
R4444
  • 2,016
  • 2
  • 19
  • 30

1 Answers1

0

For the command

twine --version

shell tries to find twine binary or script in $PATH. If it cannot find the script it emits the error -bash: twine: command not found. This means that pip has installed twine into a directory not in the $PATH. Find out where pip has installed it using the command

pip show --files twine

and add the directory to the $PATH.

For the command

python3 -m twine --version

shell finds python3 and python3 -m looks for a module twine, not a script. python3 -m looks for the module in sys.path, a completely different search path.

phd
  • 82,685
  • 13
  • 120
  • 165