Python console_scripts doesn't work when pip install --user

北城余情 提交于 2019-12-31 05:29:27

问题


I wrapped my code into python package and now I want it to be also runnable from the command line (linux). So I added console_scripts tag to setup.py and all seems to be working fine when I pip install it as a root. (I can run program from the command line)

However I'd also like for a package to be installed by using

pip install --user .

so it can be installed on computers when root is not available to the user. However when I try to invoke program from the command line i got 'command not found'. The pip installation finishes successfully and I can still run it using

python my_prog.py

But I wonder is there any solution to this problem. Can someone please explain how the console_scripts setup.py tag actually works?

Any ideas welcome.


回答1:


pip installs the scripts under ~/.local/bin. You need to add this to your PATH with:

export PATH=~/.local/bin:$PATH


来源:https://stackoverflow.com/questions/46973667/python-console-scripts-doesnt-work-when-pip-install-user

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!