conda 管理包很方便,但並不是所有包都有最新的 conda 版本,所以仍需要使用 conda 中的 pip 來安裝包。
以 conda 安裝路徑 ~/miniconda
、環境名稱 tf2.1
為例,conda 環境中的 pip 路徑為:
~/miniconda3/envs/tf2.1/bin/pip
查看該 pip 的指向:
~/miniconda3/envs/tf2.1/bin/pip -V
那么安裝最新版 tensorflow_datasets:
~/miniconda3/envs/tf2.1/bin/pip install --upgrade tensorflow-datasets
PS:在使用 pip 時,最好先執行 pip -V
看清 pip 的指向,conda activate tf2.1 之后,pip 仍然可能不指向環境 tf2.1 的 python。