刚刚在 Mac OSX Mavericks 上下载并安装了 anaconda 3.6.2,我需要安装一个没有预装 anaconda 的包 seaborn
。
$ conda install seaborn
Fetching package metadata: ..
Error: No packages found in current osx-64 channels matching: seaborn
You can search for this package on Binstar with
binstar search -t conda seaborn
You may need to install the Binstar command line client with
conda install binstar
接下来我尝试使用pip
安装包
$ which pip
/Users/username/anaconda/bin/pip
$ pip install seaborn
Could not find an activated virtualenv (required).
尝试再次激活 root
Anaconda env,但仍然无效
$ source activate root
discarding /Users/username/anaconda/bin from PATH
prepending /Users/username/anaconda/bin to PATH
$ pip install seaborn
Could not find an activated virtualenv (required).
接下来我尝试激活一个 virualenv 并且 pip install
工作。
workon testEnv
pip install seaborn
现在我从 Anaconda 的启动器启动了 iPython notebook
。但是好像没有找到seaborn
包!
是否真的安装了seaborn
包?
在 ~/bashprofile
中,我有:
# virutalenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /Users/username/.virtualenvs/datasci/bin/virtualenvwrapper.sh
# added by Anaconda 2.0.1 installer
export PATH="/Users/username/anaconda/bin:$PATH"
更新
删除了 2 条 virtualenvwrapper 行,重新加载了 .bash_profile,但是 pip install
仍然给出错误 Could not find an activated virtualenv (required).
激活另一个 conda 环境 source activate testenv
没有帮助。
$ source activate ~/.bash_profile
$ pip install seaborn
Could not find an activated virtualenv (required).
$ source activate testenv
discarding /Users/username/anaconda/bin from PATH
prepending /Users/username/anaconda/envs/testenv/bin to PATH
$ pip install seaborn
Could not find an activated virtualenv (required).
最佳答案
你需要安装anaconda版本的pip。只需运行:
conda install pip
这将在激活的 conda 环境中安装 pip
关于python - 无法在 Anaconda 中 pip 安装包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25467595/