LoginSignup
0
1

More than 1 year has passed since last update.

Anaconda「zshでコマンドプロンプトが効かない」

Last updated at Posted at 2021-06-04

現在、pythonを勉強しようとしております。
本日はmacでAnnacondaをインストール後、zshでcondaコマンドが効かない現象が起きたのでメモとして残しておきます。

zshでcondaコマンドが効かない

なぜこの現象が起きたのかを見たところ、Anacondaをインストールした同時にパスを通す記述がされるのは~/.bash_profileだったことが原因なようでした。

ターミナル
% conda info
zsh: command not found: conda
ターミナル
% which python
/usr/bin/python #macのデフォルトのpythonのパス

% python --version
Python 2.7.16 #インストールしたのはpython 3.~なはず。。。

自分:「え!ダウンロードしたじゃん!condaコマンド使えるでしょ!おかしいよ!」
zshさん:「....そんなコマンドないし、読み込むパスないもん。」


とりあえずbash_profileの中身を移して解決

ターミナル
% less ~/.bash_profile
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!

~()~

# <<< conda initialize <<<

上記の中にある/Users/Owner/opt/anaconda3/bin/pythonまでをコピーしてzshファイルに記述する。

ターミナル
% vi ~/.zshrc

iボタンを押してインサートモードにしてから

↓をペースト
/Users/Owner/opt/anaconda3/bin/python

escボタンを押し、:wqを入力する。

% source ~/.zshrc

一応ターミナルを再起動

実行後

% which python
/Users/Owner/opt/anaconda3/bin/python

% python --version
Python 3.8.5

こちらで一旦解決できました。
問題点などあれば、コメントいただけますと幸いです。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1