简体   繁体   中英

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

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, eg /Users/yimingliu/Library/Python/3.8/bin/stcgal -h . So, I wonder is there a shortcut for Python to run this file in Terminal?

尝试这样的事情:

python -m stcgal -h

您可以创建或编辑您的/Users/yimingliu/.zshrc文件(如果您的 macOS 早于 macOS Catalina 10.15,则该文件是/Users/yimingliu/.bash_profile ),并添加一行将 python bin 文件夹添加到您的小路:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM