且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Ubuntu Linux上将Flutter SDK永久添加到PATH?

更新时间:2023-11-11 20:38:04

对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.