Home > Article > Backend Development > How to set conda environment variables
Conda environment variable setting steps: 1. Find the installation path of conda; 2. Open the "System Properties" dialog box; 3. In the "System Properties" dialog box, select the "Advanced" tab, and then click "Environment Variables" button; 4. In the "Environment Variables" dialog box, find the "System Variables" section, and then scroll to the "Path" variable; 5. Click the "New" button, and then paste the conda installation path; 6. Click "OK" to save the changes; 7. Verify whether the setting is successful.
The operating system for this tutorial: Windows 10 system, Python version 3.11.4, DELL G3 computer.
To set the conda environment variable, you can follow the following steps:
1. Find the installation path of conda. On Windows, conda is installed by default under the "C:\Users\Your_Username\Anaconda3" folder; on Mac or Linux, by default it is installed under the "/Users/Your_Username/miniconda3" folder.
2. Open the "System Properties" dialog box. On Windows, you can press the Win Pause/Break key combination or search for "System" in the Start menu and select the "System Properties" option; on Mac or Linux, you can open a terminal and enter "sysdm.cpl" and then Press the Enter key.
3. In the "System Properties" dialog box, select the "Advanced" tab, and then click the "Environment Variables" button. This will open the Environment Variables dialog box.
4. In the "Environment Variables" dialog box, find the "System Variables" section, and then scroll to the "Path" variable. This is the search path used by the operating system to find executable files.
5. Click the "New" button, and then paste the installation path of conda (that is, the path found in step 1). Make sure the path ends with a semicolon (;).
6. Click "OK" to save the changes. Now, conda's environment variables have been set.
7. Verify whether the setting is successful. You can open a new command prompt or terminal window and type "conda --version" command to check whether conda has been set up correctly. If you see the version information of conda, the setting has been successful.
In addition, you can also use the conda command line tool to set up the environment Variables. The specific method is as follows:
1. Open a terminal or command prompt window, and then activate the conda environment where you want to set environment variables. You can use "conda activate env_name" command to activate the environment, where "env_name" is the name of the environment where you want to set the environment variable.
2. In the activated conda environment, run the following command to set the environment variable:
Visual Basic .NET
config --add my_var=value
Where, "my_var" is the name of the environment variable to be set, and "value" is the value of the variable. If you want to set multiple environment variables, you can reuse the above command.
3. Verify whether the environment variables are set successfully. You can enter the following command in the terminal or command prompt window to view the settings of all environment variables in the current environment:
Bash
conda env config vars list
If See that the set "my_var" environment variable has been successfully listed, then the setting has been successful.
Please note that the above steps are general methods for Windows, Mac and Linux operating systems. Specific operating systems and platforms may There will be differences, but the basic steps are similar. If you encounter problems, it is recommended to consult conda's official documentation or seek help in the relevant technical community.
The above is the detailed content of How to set conda environment variables. For more information, please follow other related articles on the PHP Chinese website!