Home > Software design >  How to run python file in Terminal (Command Line) after installing it using pip?
How to run python file in Terminal (Command Line) after installing it using pip?

Time:06-26

I'm a embedded system learner, and know little about Python. I'm using macOS. I installed stcgal using pip3 with pip3 install stcgal following its official guide.

I find it was installed at /Users/yimingliu/Library/Python/3.8/bin/stcgal. Every time I need to type this long address to access it when I want to run it, e.g. /Users/yimingliu/Library/Python/3.8/bin/stcgal -h. So, I wonder is there a shortcut for Python to run this file in Terminal?

CodePudding user response:

Try something like this:

python -m stcgal -h

CodePudding user response:

You can create or edit your /Users/yimingliu/.zshrc file (if your macOS is older than macOS Catalina 10.15, then the file is /Users/yimingliu/.bash_profile), and add a line to add the python bin folder to your path:

export PATH=/Users/yimingliu/Library/Python/3.8/bin:$PATH
  • Related