如何在Ubuntu Linux上将Flutter SDK永久添加到PATH? [英] How to add flutter SDK to PATH permanently on ubuntu linux?
问题描述
我对使用linux作为主要操作系统非常陌生.昨天我刚刚在PC上进行了全新的ubuntu安装.之后,我开始设置桌面.正在安装任何必需的东西来运行抖动,但是每当我运行flutter
flutter: command not found
时.我曾尝试在stackoverflow上看到类似的问题,但是我没有看到在ubuntu上的PATH上添加flutter的特定配置,这对我来说有点困惑,因为我现在还没有Linux的经验.
I'm very new to using linux as my primary OS. Yesterday I just did a clean install of ubuntu on my pc. I after that I started setting up my desktop. Anything necessary is being installed to run flutter but whenever I run flutter
flutter: command not found
. I have tried seeing similar questions on stackoverflow but I do not see specific configuration of adding flutter to PATH on ubuntu and it is kinda confusing to me since I'm not experienced with linux for now.
当我在终端中输入以下export PATH="$PATH:development/flutter/bin"
命令时,颤动是有效的,但是当我关闭在其中输入了该命令的那个终端并动臂时,颤振将不再在控制台中被识别.
When I enter the following export PATH="$PATH:development/flutter/bin"
command in the terminal, flutter is working but when I close that terminal in which I entered this command and boom, flutter is not being recognized in the console again.
我想要的是将flutter sdk永久添加到PATH,以便我随时可以在终端中访问flutter
命令.
What I want is flutter sdk to be added permanently to PATH so that I can access flutter
command whenever I want in the terminal.
我正在使用ubuntu -v Ubuntu 18.04.3 LTS
.
谢谢.
I'm using ubuntu -v Ubuntu 18.04.3 LTS
.
Thank you.
推荐答案
对pskink的答案进行一些扩展:
To expand a little on pskink's answer:
1.要修改〜/.profile:
sudo gedit ~/.profile
2.将目录添加到PATH变量(即Linux在其中查找程序的位置):
.profile文件的最后一行应如下所示*:
The last line of your .profile file should look something like this*:
export PATH="/home/tom/Flutter/flutter/bin/cache/dart-sdk/bin:/usr/bin/python:${PATH}"
*用Flutter在计算机上的任何位置替换"/home/tom/Flutter/flutter/bin/cache/dart-sdk/bin".如果要向路径变量添加其他文件夹,请查看我放置:/usr/bin/python"的位置.确保以:$ {PATH}"结尾.
*Replace "/home/tom/Flutter/flutter/bin/cache/dart-sdk/bin" with wherever Flutter is located on your machine. If you want to add additional folders to your path variable, have a look at where I placed ":/usr/bin/python". Make sure to end with ":${PATH}".
3.最后步骤:
完成后,保存更改,重新登录用户,然后打开一个新终端.
When you are done, save the changes, re-login the user, and open a new terminal.
这篇关于如何在Ubuntu Linux上将Flutter SDK永久添加到PATH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!