Linux自定义可执行文件全球可用 [英] Linux custom executable globally available

查看:69
本文介绍了Linux自定义可执行文件全球可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以zip格式下载了Google App Engine,并将其解压缩到/usr/local/google_engine

I downloaded the Google App Engine as a zip format, unzipped it to /usr/local/google_engine

现在,我需要一直从该文件夹运行python脚本.无论我在哪里,如何使它可用?即:当我在/usr/something/中时,我可以通过调用script.py来执行脚本?

Now I need to run a python script from that folder all the time. How do I make it available no matter where my path is? ie: when i'm in /usr/something/ i can execute the script by just calling script.py?

我可以在不使用别名或不使用bash脚本的情况下执行此操作吗?

Can I do this without aliasing or without using bash scripts?

推荐答案

编辑您的.bashrc,以将所需目录添加到PATH环境变量中.

Edit your .bashrc to add the desired directory on the PATH environmental variable.

export PATH=/usr/local/google_app_engine/bin:$PATH

然后,启动新终端或执行

then, either start new terminal or do,

source ~/.bashrc

现在尝试从任何地方运行脚本.

Now try to run the script from anywhere.

另一种无需触摸.bashrc即可完成此操作的方法是通过执行类似的操作来创建符号链接,

Another way you can do it without even touching the .bashrc would be to create a symlink by doing something like,

sudo ln -s /usr/local/google_app_engine/bin/script.py /usr/bin/script.py 

这篇关于Linux自定义可执行文件全球可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆