Skip to content
Image with logo, providing a link to the home page
  • United Stated of America flag, representing the option for the English language.
  • Bandeira do Brasil, simbolizando a opção pelo idioma Português do Brasil.

Development Environments: How to Set Up (Install) and Configure Programs

Illustration of some steps involved to install and use programs on Windows: authorizations to run executable files, setup process, creation of shortcuts, and options to use the program.

Image credits: Image created by the author using the programs Greenshot and Gimp.


To better understand the content of this article, it is recommended to know the basics about using file managers. For the basic part of the content, it is enough to know how to browse local file directories, open files and folders, and run programs. For the section Advanced Configuration, it is necessary to understand concepts about paths.

Warning. You should always be careful when using files acquired from the Internet and other sources external sources. Files can contain malicious content, such as virus, spyware and malware. You should always use the official page of a project as your source for programs (or other reliable sources). The author of this page is not responsible for external files that you download and use. As always, you should do your research before trusting Internet content.

Video Version

This entry has a video version available on the YouTube channel. Although this text version is more complete, you can follow the video first, if you prefer it.

What is Your Operating Systems?

In few words, a operating systems is the program responsible to manage other programs in your computer, as well as mediate how they can use the hardware.


If you are using a computer or a desktop, you probably use Windows. The contents of this entire page applies to you.

If you do not have experience with computer and want to ease the setup at this time, or even if you are experienced, though you would like to automate the setup of some programs, you may want to check out Ninite. Ninite is also a good alternative if you have never installed a program before. Although the list is not very extensive, the programs available to install using Ninite are enough to start to program in:

  • JavaScript;
  • Python;
  • Java;
  • C#.

A possible drawback is that (I believe) Ninite install programs in English, if you would rather use programs in you mother language. The main advantage is that Ninite manages the setup on its own -- even for multiple programs. If this idea suits you, a subsection of this page shows how to use Ninite to obtain programs for the previous programming languages.

Before starting, you may need an initial setup. In the settings menu (type Settings or Control Panel in the Start menu), search for Apps and access it.

The Windows Settings interface with the focus on the option `Apps`.

Next, you should enable installing files from any origin (Anywhere), if you need. In reality, any of the first three options are suitable (Anywhere, Anywhere, but let me know if there's a comparable app in the Microsoft Store and Anywhere, but warm me before installing an app that's not from the Microsoft Store). Thus, if you would rather use the Windows Store, you can choose the second or third options.

After accessing Apps, search for the option `Choose where to get apps` and set it to `Anywhere`.

The first option is convenient for programming because, sooner or later, you will run your own programs in your computer. Naturally, they will not be available at he Windows Store until you publish them there (that is, provided you publish them at some time).

Windows with Command Line Experience

If you are experienced with command line and wish to automate setups, check out Chocolatey and Scoop. Windows also has official package manager under development. It will be my recommendation in the future. At this moment, Scoop and Chocolatey are good alternative for those with command line experience, because they are convenient to install programs that are part of their catalogs.

For instance, to install the interpreter for the Python programming language using Scoop, you just need to type in a cmd or PowerShell prompt:

scoop install python

With Chocolatey:

choco install python

Windows administrator permissions are usually required to install programs on the operating system. Thus, you may need to run cmd as Administrator. To do this, you can type cmd at the Start menu, then right-click on the resulting icon and choose the option to start the program as administrator.


The remainder of this page can useful to you, particularly the parts regarding PATH configuration. The main difference is that, if your distribution provides a package manager, it is simpler to install programs using it. To find out how to do it, check the documentation for you distribution.

For instance, each following distribution has the following package manager(s):

  • Arch Linux: pacman;
  • Debian and Debian based systems (such as Ubuntu): apt and aptitude;
  • Fedora: dnf / yum;
  • Gentoo: portage / emerge.

For instance, to install the interpreter for the Python programming language using the Arch Linux distribution, the only requirement is running the following command on an interpreter:

pacman -S python

After you confirm the command and wait the end of the setup, the program is ready to use.

python --versionPython 3.9.7
pythonPython 3.9.7 (default, Aug 31 2021, 13:28:12)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Olá, meu nome é Franco")Olá, meu nome é Franco

Some distributions provide graphical interface wrappers to abstract the use of package managers.

After installing programs, configure them.


Unfortunately, I cannot assist you. I am not experienced with Mac. I have used it for a few hours over my lifetime.

As macOS roots come from Unix, some concepts explored for Linux are also applicable to Mac (especially if you use the command line). However, the system has its own conventions, so you should expect differences.

You may be interested in research brew, as it is package manager for macOS.

Android, iOS or Other Operating System for Mobile Devices (such as Smartphones and Tablets)

Use the application store of your system.

Nevertheless, you will need heroic and unnecessary efforts to program using a mobile device. If possible, I would advise to use a computer. If it is not possible, I would recommend using a keyboard that is compatible with your device (and hope).

Furthermore, you might be unable to install compilers and interpreters on iOS systems. The following section describes an alternative.

I Cannot Install Programs in My Computer or Mobile Device

If you have a computer, I would recommend learning JavaScript using the builtin interpreter. In a modern browser, the embedded console is an option to learn.

As a last resort, an alternative is using sites websites providing online programming environments. For instance:

Although the services are convenient, it is worth noting that the code you write will not be stored on your machine. Therefore, you should read the terms of service carefully to know what the service does with your code. Similarly, be careful with everything you submit to the system. Never provide private information or secret data in online programming environments. You should only write code that you would publicly share with any other person (including those you do not know).

Another option is the test mode provided by Jupyter (formely named Jupyter Notebook). It may have fewer choices for programming languages, though it is a valid option. Further details on the page describring development environments for Python.

Program Installation (Setup)

Whatever your operating system is, the classical install process is basically the same:

  1. You acquire the files (for instance, from the Internet, USB drives, CDs or DVDs);
  2. You browse to the directory that store the acquired files;
  3. You use the acquired files.

Downloading Programs

As of 2021, it is probably that most programs you use or will use are distributed through the Internet. Web browsers provided one of the simplest way to acquire a file from the Internet. As you have accessed this page, you are probably using a browser (other options are less likely, such as reading a print version of this page)

The usual process to download a file is browsing to a page that hosts the content (or that provides a hyperlink to it), click on a hyperlink to access it, confirm the start of the download (if needed), then wait for its conclusion.

There are other ways to download files, such as using the command line (for instance, using curl and wget in Linux) or programming. However, they are not in the scope of this entry.

Finding the File

After the download finishes, there are three main ways to access your file:

  1. The most traditional is browsing to the directory on which you saved the file using a file manager;
  2. Many browsers let you click once or twice on a downloaded file (displayed in a download list) to access it;
  3. Many browsers provide an additional option to browse the directory on which the file was saved using the system's standard file manager.

The first and third approaches are, usually, the safest ones, as they allow you to use a program to verify the file for malicious code before running the program. Especially in Windows systems, the verification can be important.

The second option is the simplest, though it is potentially the most dangerous. You should only run directly files with origins that you fully trust.


Some sites and project provide checksums to allow checking if a downloaded file was not modified during the transfer between the origin to your computer. If the origin page is safe (for instance, it was not the target of an external attack), a checksum can also serve to verify the authenticity of the file.

There are certain algorithms that calculate a value that represents a file. Two identical files have the very same checksum. If the algorithm is good enough, two different files should have different checksums.

Thus, you can calculate the checksum of a file and compare it to the expected one. With a good algorithm, the files are identical if the values match.

On Windows, you can calculate the checksum of a file with the command Get-FileHash in Powershell.

Get-FileHash C:\Users\Franco\Downloads\File.exe -Algorithm SHA256

On Linux systems, commands such as md5sum, sha1sum e sha256sum serve the same purpose.

sha256sum /home/franco/Downloads/File

The output will be a sequence of values. Something like, for instance,

sha256sum /home/franco/Downloads/Fileff99b66abad87baefe7203fd886a2ed85ac5a1250fa3f6945b645241d5b4cfca  File

Unfortunately, in practice, many people do not use checksums, nor many pages provide the expected values.

Installing the Program

After you locate the file, you should check the format of the file before proceeding.

Após localizar o arquivo, o próximo passo é verificar o formato. There are four common forms for program files downloaded from the Internet:

  1. It is an executable file (.exe on Windows) containing the entire program. In this case, the only requirement is running the file to run the program. Everything that is required by the program is embedded into the file (it is self-contained). On Windows, such programs are also called portable programs or applications;
  2. It is an installation file (an installer) for the program in the format of an executable file (.exe no Windows). In this case, you run the file and you follow the steps that will install the program. This happens, normally, following a pattern called wizard, that guides the entire process;
  3. It is a compressed file (for instance, with a .zip extension) that stores all files that are required by the program. In this case, you extract the contents to any directory that you want. After you access that directory, you search for the executable file to run the program;
  4. It is a hybrid of the previous cases (usually of the second form), on which the setup file (usually an executable with the .exe extension on Windows) downloads other files from the Internet and performs the installation. In this case, you need Internet connection to continue the setup.

At times, the third form contains an executable (or other compressed file) inside the downloaded file instead of the program files. In this case, you repeat the process again until you obtain a setup file or the files to use the program.

Configuring Your Setup and Using Advanced Configuration

When you are installing new programs (and also when you are using any program), you should read everything before proceeding. Many people click on options such as Next, Advance, Continue or Agree indiscriminately, without verifying what they do. At times, this results on the installation of unnecessary or undesirable features.

Unfortunately, additional options are not always present on the standard setup wizard. Thus, it is recommended to opt for advanced configuration instead of simply proceeding. Many times, the advanced installation is almost as simple as the standard one, with the advantage of allowing to remove parts of the program that you may judge unnecessary. This way, you may be able to improve some aspects of privacy and security with a few more clicks.

Furthermore, configuration often allows choosing custom directories to install programs. Unless changed, the program will usually be installed on the default directories defined by the operating system. On Windows, this directory is often name Program Files. On Linux, the directory is usually one among /bin/, /sbin/, /usr/bin/, /usr/sbin/ /usr/local/bin/ or /usr/local/sbin/.

Regardless of choice, there are required permissions to install programs in a directory. If a program setup fails, you should verify read, write and run permissions of the account that you have used to install the program.


Shortcuts are files that make it easier to start a program installed on the computer, usually through an icon placed in an easy-to-access place.

Some wizards allow you to create a shortcut during the program setup. Shortcuts on places such as the desktop or quick start bar are convenient for programs that you use often.

Although you can create your own shortcuts later, it can be convenient to request the creation during the setup. For beginners, in particular, the choice can avoid the need to find the place that the program as installed either to run it or to create a shortcut manually. Nevertheless, an excessive number of shortcuts can be undesirable.

Shortcuts are optional. In general, you can find a program using the main menu of the operating system (for instance, the Start menu on Windows or the Kickoff menu on KDE). As a last resort, you can always search for the installation directory using a file manager.

Licences of Use

People often ignore reading the licence of use when installing programs. Depending on the intended usage, it is important to read it carefully (especially if you want to use the program commercially).

Personally, I choose to use free (libre) software and open source whenever it is possible.

Installation Under Progress and Copying the Files

After some steps, the program files will be copied to your computer. After some time, the program will be ready for use.

Execute (or Run) the Program

The meaning of executing or running a program is starting it into a command interpreter. This also happens on graphical environments, which abstracts the process behind the scenes.

If the program setup has created a short to the program, you can use it to start using the program. In general, this one of the simpler options (especially for beginners).

Otherwise, you have to find the program before using it. To do this, you can:

  1. Browse to the directory on which the program has been installed;
  2. Search for the program using your operating system search features;
  3. Use a command line interpreter to run the program using its path and/or name.

Sooner or later, your computer will not find a program that was installed or downloaded.

To use a program, you need to know where the program files are. This also applies to the operation system. Operating systems have specific places to search for files. These places are often store in an environment variable called PATH, that may belong to the system as a while or to specific user accounts. Programs that are not stored on these places require intervention of the user to work, who must show the operating system where it will find the files. To do this, you either provide the absolute path to the program whenever you want to use it, or you add the program directory to the PATH environment variable.

Something that can be confusing is that the PATH environment variable is not a file path, but a sequence (a list) of directory paths. The section Advanced Configuration discusses how to configure it.

Any program stored in a directory that belong to the PATH can be started by typing its name on a command line interpreter (or the operating system menu, such as the Start menu) followed by pressing enter.

Any program that is not on PATH requires the path to the program to run it. On Linux systems, this is usually the reason that you need to type ./program-name to run the file program-name in the current directory.


Once a program is installed and running, everything seems to be ready. In fact, it normally is.

Many people install a program and start using it. Personally, my first even use starts by searching for the program's configuration menu to discover options to toggle on or off. These operations are usually in places such as File / Settings (which may require pressing Alt to appear), Edit / Settings or in Tools / Settings.

Try to create a habit of personalizing your most often used programs whenever possible to better suit your preferences and use profile. Always make the system work for you; do not work for it.

You can improve your use experience by modifying appearance, privacy and security settings according to your tastes. A system may do things that you do not know it does. Avoid unwanted surprises whenever it is possible.

Complete Example: Installing Firefox

As, statistically, most people use Windows on computers, the following example shows how to install a program on Windows. In this example, we show how to install the Mozilla Firefox web browser.

To install it, access the Firefox site. Often, though, you will not know what site you should access to download a program. Whenever this happens, you can use a web search tool to search for the desired program. For instance, you can search by "firefox" or by "mozilla firefox" in a service such as Google, Bing or DuckDuckGo. The previous links with keywords use DuckDuckGo.

A reproduction of Firefox's official website retrieved when this article was written. The download option is available on a button called `Download Firefox`.

Once the page loads, you should look for an option called download. Most websites make it easy to find it. Usually, the option will be highlighted in the main page or in the page's navigation options. Click the option and wait a few seconds.

After choosing the download option, the download should start automatically or wait for a confirmation. In this case, it is necessary to confirm the start by choosing `Save File`.

Depending on your configurations, the download can start automatically or require a confirmation. In the second case, you may need to click on the download window that has appeared to enable the option to save the file (Save File).

After the download starts, you have to wait its finish. The required time interval depends on the file size and your Internet connection speed. You can monitor the progress in the downloads option of your browser.

The download progress interface displaying that the download was completed.

After the download finishes, you can click on the name of the downloaded file, click on the folder icon to open its containing directory, or click with the right button to show the context menu and choose an action.

The context menu for the downloaded file. Options include open containing folder, go to download page, copy download link, remove from history and clear preview panel.

Alternatively, you can open File Explorer to browser to the directory that you have saved the file. The default option is to store downloaded files on the folder Downloads of the user account (for instance, for a user named Franco, )

The file inside the Downloads folder.

If you wish to use an antivirus or other program so scan the file before using it, click with the right button to open the context menu and choose the desired option. On Windows, it is a good habit to scan files before using them (as long as your scan programs are up-to-date). Naturally, caution and common sense are also fundamental to keep your computer secure and free of virus, spyware and malware. The illustration suggests the use of the Microsoft Defender, the integrated solution preinstalled on modern Windows systems. You can use your favorite solution instead.

The context menu for the Firefox installer file, with the optoin to scan the file with Microsoft Defender highlighted.

Once you try to run the file, Windows may show an alert. If you trust the source of the file, choose the option to run it (Run). It is important to learn how the process work because your own programs will request the same authorizations. In particular, the publisher name may appear as Unknown on the programs that you create.

A security warning before running a file. You should choose `Run` only if you trust the file. On the image, `Publisher` value is `Mozilla Corporation`.

After you choose to run the file, a second security warning may appear, with a request from the User Account Control to confirm the installation. This warning can appear minimized; it can also expand to the whole screen and block the use of your computer until you answer it. The behavior depends on the configurations of your system. Program installation depends on higher privileges, because they may modify data of the system. Thus, they usually require confirmation from an account with administrator privileges (potentially requesting its password). Once again, if you trust the file, you should choose Yes to continue the setup.

A imagem do User Account Control solicitando confirmação antes da instalação do navegador Firefox.

In the case of Firefox, the setup follows the fourth described way, that is, the installer download other files from the Internet to continue the process. The installation time will depend on the total size of the required files and the speed of you Internet connection.

The installation process with a setup progress bar (around 40% filled). After the setup finishes, the program will be ready to use.

Once the setup finishes, a shortcut should appear on the desktop to start the installed program. On Windows, the image should have a square with an arrow meaning that it is a shortcut instead of the real executable file. A shortcut is a file that references another file (or other shortcut that references a file, and so on). Its purpose is providing a fast way to start a program without needing to find it in the file system.

The Firefox shortcut that has been added to the desktop by the installer.

If a shortcut does not show in the desktop, you can search for the program by typing its name in the Start menu. The search also provides another useful feature on the results screen. Open file location opens the directory on which the file is installed (or the shortcut, depending on the case). If you choose the option, Windows will open File Explorer windows on the file's directory. If it is a shortcut, you can right-click it and, once again, choose Open file location to reach the directory that the program was installed. This is useful to find out the absolute path of the file on the system, in the case that you do not know exactly where the program was installed to configure the PATH. Another important option is Run as administrator), which enables you to run a program with higher privileges (something that may be required, for instance, by some uses of cmd).

Search results from the Start menu using the query `firefox`. The first result opens the newly installed file. Other options include `Open`, `Run as administrator` and `Open file location`.

If you use a program often, you can also right-click its icon on the bottom bar (the one with the Start menu and the clock) to open the context menu and choose the option Pin to taskbar. The taskbar lists open programs (regardless whether they are open or minimized).

An example of how to create a shortcut on the taskbar. After you open the context menu for a program in the taskbar, you can choose to fix it there for quick access.

Windows: Set Up Your Environment for Some Program Languages Using Ninite

If you aim to program in several programming languages and wish to save some time, though you do not know how to use the command line (or if you do not learn how to use Chocolatey or Scoop), Ninite can be a convenient option.

Access Ninite website, scroll down then mark the following options:

  1. JavaScript:
    • Web browsers (pick one or more):
      • Chrome;
      • Firefox (my personal recommendation);
      • Edge.
    • Developer tools (pick one or both):
      • Notepad++;
      • Visual Studio Code.
  2. Python:
    • Developer tools (required):
      • Python x64 3 (if your computer is very old, you need to follow the one below it, which is 32-bit);
    • Developer tools (pick one or both):
      • Notepad++;
      • Visual Studio Code.
  3. Java:
    • Developer tools (required; pick one or both):
      • JDK (AdoptOpenJDK) x64 8 (as for Python, if your computer is very old, it can be better to install the 32-bit JDK (AdoptOpenJDK) 8);
      • JDK (AdoptOpenJDK) x64 11.
    • Developer tools (pick one or more):
      • Notepad++;
      • Eclipse;
      • Visual Studio Code.
  4. C#:
    • Developer tools (required; pick one or both):
      • .NET 4.8;
      • .NET Desktop Runtime x64 5.
    • Developer tools (pick one or more):
      • Notepad++;
      • Eclipse;
      • Visual Studio Code.

If you are starting, I recommend always marking the option to install the Notepad++ text editor, because it is simple and provides good features.

After you make your choices, scroll down and click Get Your Ninite. Next, browse to the downloaded file, double click to run the program (which will be named something like) Ninite ... Installer.exe and wait for the conclusion.

After it finishes, you will have required programs to start developing in JavaScript, Python, Java and/or C#, according to your choices.

Naturally, you can also mark any other program that interests you from the list. For instance:

  • KeePass 2 as a password manager (I strongly encourage the use; never uses the same password in more than one place);
  • PuTTY and WinSCP for SSH, FTP e SCP clients (they are useful for Web development);
  • VLC to play media (audio and video);
  • SumatraPDF to read PDF files;
  • 7-Zip to compress and decompress files;
  • Greenshot for screenshots;
  • Krita, Blender, GIMP and Inkscape for drawing, image edition and 3D modeling;
  • Audacity for audio edition;
  • ImgBurn to burn images into CD and DVDs;
  • LibreOffice and OpenOffice as Microsoft Office compatible alternatives.

Most of the previous programs pare part of my Windows install (though I install most of them with Chocolatey, Scoop or from the official website).

As a final note, Ninite can also update that programs that it installs. If you run the installer again, it will try to update the chosen programs.

A Example of Using Ninite to Install Programs

The following sequence of operations illustrate how to use Ninite to install the programs Firefox, Python x64 3, Notepad++ and Visual Studio Code. The four programs are enough to start programming activities in JavaScript and Python.

Ninite homepage with the marked checkboxes for the programs Firefox, Python x64 3 and Visual Studio Code. The cursor is over `Get Your Ninite` for the generation of the installer file.

You can add or remove programs from the previous list, according to your needs. If you want to add other programs, you can select all the ones you want at once. When you are satisfied with your choices, click on Get Your Ninite.

The page resulting from `Get Your Ninite`, which summarizes the selected programs and provides a request to start the download.

The download should start after a few seconds. The download process is always the same, regardless of program of file. If you need, click on the window that appears and then on Save File.

The File Explorer with the installer (`Ninite Firefox Notepad Python x64 Installer.exe`) selected.

After the download finishes, access the file directory. Click twice to start the setup of the chosen programs using Ninite. As with Firefox, Ninite requires an Internet connection to download and install the other programs.

An image with the setup progress of Ninite.

The installer will download the required files for each program, installing them one by one. If any of the programs are already installed on your machine, Ninite will try to update them. If they are already up-to-date, it ignores them.

A screen with the results of Ninite installer. In this case, Firefox install was ignored (for it was already installed and up to date), and Python x64 3, Notepad++ and Visual Studio Code where installed.

After the setup ends, new icons should appear on your desktop for some programs. However, perhaps that some programs will not have icons.

Desktop icons for Firefox, Notepad++ and Visual Studio Code.

For programs missing shortcuts, as the Python interpreter, you can locate the files using the Start menu search. Click on it, then search by name (for instance, Python). After some seconds, the search results should appear.

Search results for the keyword `python` in the Start menu. The `Python 3.9 (64-bit)` interpreter is the first result, with options including `Open`, `Run as administrator` and `Open file location`.

If you click over the icon (Python 3.9, when this article was written), the interpreter should start. To test it, type on the window that appears something like:

print("Olá, menu nome é Franco")

Next, press enter.

After you write `print("Olá, meu nome é Franco")` on the Python interpreter and press `enter`, the system will show the message "Olá, meu nome é Franco".

Congratulations! You have just written your first program using the Python programming language.

Back to the start Menu, search again for python, though this time select the option Open file location. If the result on File Explorer is another shortcut, right-click the file again to open the context menu and choose the option to open the file location again. Repeat the process until you find a file without the shortcut icon. Check the absolute file path (in my case, C:\Program Files\Python39). This is the required path to configure the PATH environment variable, described next.

Advanced Configuration

The previous guide is enough to most programs requiring installation, though not for all. Some programs (especially compilers and interpreters) may need additional configuration, especially if you do not use an IDE.

For first activities, it is optional to configure the PATH environment variable. For instance, for Python, it is truly important to install the interpreter and the machine and being able to run it. However, it can be useful to know how to configure PATH for when it becomes necessary.

Environment Variables

File systems map files and folders into paths, which can be relative or absolute.

File systems and operating systems provide a feature called environment variable to avoid the need of absolute paths and ease using programs on different machines (with different machine and user names, and folder structures).

An environment variable stores arbitrary values that you can configure as necessary. In particular, programming related applications often use (and require) the use of environment variables.

Some uses for environment variables for programming activities can include:

  • Names and directories for compilers, interpreters and debuggers;
  • Directories for source code and object code libraries;
  • Directories to search for program names;
  • Directory of configuration files;
  • Directories to save data (either temporary or permanently) to use a program.


An important environment variable, which is available in many operating systems, is called PATH. It sets directories on which a command line interpreter (and/or the operating system) should search for names passed as commands for the interpreter. In other words, program line commands are programs, either compiled or interpreted.

Any program available at one of the directories existing in PATH can be accessed using its name, in any directory of the computer. For instance, Notepad is a default program on Windows. The name of its executable is notepad.exe. If you hold the Super key (the one with the Windows logo: ) and press r next (Super r), the operating systems will prompt for a command name. If you type notepad.exe in the text field then press enter, the interpreter will open the Notepad program.

On the other hand, if a file is on your desktop (let us say, MyProgram.exe) and you try to run with using Super r, the program name and enter, the interpreter will not find the program. This happens because the desktop folder is not defined by default as part of the PATH. If you type the absolute file path (for instance, C:\Users\Franco\Desktop\MyProgram.exe), the program will work.

Whenever you want to access a program from anywhere, you must add the program directory into the PATH. This is called exporting a value.

Problems can happen when certain programs depend on other programs to run. As arbitrary programs cannot (or, theoretically, should not be able to) access your computer data to verify whether a program exists, they often assume that a program exists and it is available to access using its name. In other words, they depend that the program path is stored on the PATH.

To fix the problem, you need to export the path of the file.

Warning. Normally, when you change the values of the PATH, you should preserve the old values. Do not remove the other entries; add your value at the start or at the end, using the separator character to delimit the values.

Adjusting the PATH on Windows

There are two ways to export environment variables: using the graphical user interface or the command line. The examples assume that you want to export the absolute path C:\Users\Franco\Desktop\. You can change the value according to your needs.

Setting the PATH via the Graphical User Interface

The interface to configure the PATH requires a few action to be accessed, though it can be the most convenient option for the first attempts.

To start, you can press Super e to open the File Explorer.

Next, right click This PC to open the context menu and choose the option Properties.

In File Explorer, search for the option `This PC`. Open the context menu and choose `Properties` The image show the focus on properties.

In the new screen, in the right part displaying Related settings, choose Advanced Systems Settings.

The advanced system settings on focus.

Next you click Environment Variables.

In the new interface, the focus is on `Environment Variables`.

Finally, you can add, remove or modify values for environment variables.

The new window has the environment variables settings. You can create new ones, modify existing values or remove them. In the image, the focus is on `New...`, used to create new environment variables.

You can define environment variables for the current user or for all accounts. For instance, to add a new environment variable, click on New.... Then choose a name for the variable, its value and confirm.

The path to the Python interpreter was added to the path `PATH` of the user `Franco`.

To modify the PATH, search for Path (exactly as written; it can either be the user of the system one; normally, it is safer to modify the user's). Double-click on an empty space of choose New in the new screen to create a new variable for the entry Path. For instance, to add Python 3.9 to the Path, add the value C:\Program Files\Python39 as a new entry. After you confirm, start a cmd session, type python and press enter. The interpreter should start. Next, write a line of code and press enter. For instance:

print("Hello, my name is Franco. This message was written on CMD with the PATH configured.")
Example of use of the Python interpreter in the `cmd`. After inputting the line of code `print("Hello, my name is Franco. This message was written on CMD with the PATH configured.")`, the interpreters writes the answer `Hello, my name is Franco. This message was written on CMD with the PATH configured.`.

Setting the PATH Using the Command Line

A linha de comando é o meio mais rápido de ajustar o PATH. For a terminal session, you can run in cmd:

set PATH="C:\Users\Franco\Desktop\";%PATH%

You can add the new entry to the beginning or to the end of the value.

set PATH=%PATH%;"C:\Users\Franco\Desktop\"

The order matters, because interpreters search for the program in the order that was defined, and they run the first program that matches the given name.

To list all values stored in the PATH, you can print the value of variable:

echo %PATH%

To save the modification permanently, you can use setx instead of set.

setx PATH="C:\Users\Franco\Desktop\";%PATH%

Instead of permanent changes with setx, you can create a .bat file and store the desired settings with the program that you wish to run on the last name. This way, whenever you want to run a program with custom PATH (or any other environment variables), you can just run the script file. The file with the script is called a shell script.

Note. The PATH is modified only for the script.

For instance, you can create a file with the name run-python.bat (you can choose any name besides python.bat ou set.bat) in a text editor with the following contents:

set PATH="C:\Program Files\Python39";%PATH%

After you save the file and double click it, the system will open a cmd window running the python interpreter. If you want to modify the file, right click it and choose Edit (which uses the Window's Notepad), Edit with Notepad++ or your favorite text editor.

Adjusting the PATH on Linux

The considerations made for Windows also apply to Linux.

The simplest way to change the PATH on Linux is to use the command line as well. The syntax, however, depends on your command line interpreter.

For instance, you can add an entry to the beginning of the PATH when using bash or zsh as:

export PATH="/home/franco/Desktop/:$PATH"

To add the directory to the end of the PATH:

export PATH="$PATH:/home/franco/Desktop/"

To verify all stored values, you can print the value of the variable.

echo $PATH

To persist the changes, you can add the entry in the configuration file used by the interpreter. For instance, ~/.bash_profile, ~/.bashrc, ~/.zshrc ou ~/profile.

If you want to use a graphical interface to perform the changes, you need to check the documentation of your environment.

Finally, the same you can create a bat file on Windows, you can create a .sh file on Linux to define a script with custom environment variables.


# Change to the desired directory.
export PATH="/home/franco/Desktop/:$PATH"
# Change to the desired program name.

The previous example uses bash as the interpreter for the script. You can choose the one you prefer (for instance, to use zsh, the first line could become #!/bin/zsh ou #!/usr/bin/zsh depending on where the interpreter is installed).

Library Directories

Besides programs, at times you will have to define environment variables with paths for library directories. This is common for languages such as C and C++.

The steps are the same used to set the PATH variable; the main difference is to change the variable name and the paths as necessary.

For instance, environment variables for the gcc compiled include CPATH, C_INCLUDE_PATH CPLUS_INCLUDE_PATH for headers and LIBRARY_PATH for object code used by the linker. When you write #include <nome_biblioteca.h> in the source code of a C program, the compiler search the file on the directories defined in the environment variables. If the compiler does not find it, the compilation will fail.

  • Video
  • Informatics
  • Programming
  • Beginner
  • Dev Env
  • Windows
  • Linux
  • KDE