Mac environment, install anaconda, terminal input conda is invalid

After downloading the installation package from the official website normally, open the terminal and configure the conda environment variable

Open the terminal and enter

vim ~/.bash_profile

Problem 1:

The reason is : there is a file with the same name, but the file format of the same name is different. This file .bash_profile.swp is caused by the fact that the editing content was not saved normally when it was created before.

Solution : delete, open the user directory, if there is no setting to display hidden files, it is not visible, so it is still in the terminal, enter

defaults write com.apple.finder AppleShowAllFiles -bool true;
KillAll Finder

Used to display. If you change true to false, you can restore the hidden state

Find the corresponding file, delete it

 

Question 2: Then modify the environment variables, if you modify the error during the process, it will cause basic sudo, cd and other commands to be unusable

Solve: enter in the terminal

export PATH=/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Modify or delete the added configuration

Question 3: Use of vi / vim

Solution: The process of modifying environment variables used vi / vim, which has not been used before, so I read some tutorials, roughly, the default is the command state when entering

  1. Enter i to switch to the input state, and then add path configuration information.
  2. After the end, press the esc key to exit the input state, enter : w to save and write, then enter : q to exit

Environment variable content : After opening the vi / vim editor, if you have configured other python versions before, temporarily use # xxx to comment out, configure anaconda, (delete the previous version part is not involved here), enter

export PATH="/Users/anaconda3/bin:$PATH"(/Users/anaconda3/bin部分输入自己的安装路径)

Then, save and exit vi / vim, and then enter in the terminal

 source ~/.bash_profile

Refresh environment variables

 

After completion, enter conda list If the display is successful, the configuration is successful, otherwise it fails, and then you can use the conda command

 

 

 

Published 16 original articles · Likes0 · Visits 452

Guess you like

Origin blog.csdn.net/weixin_43951831/article/details/105053957