python - 无法在 Anaconda 中 pip 安装包

标签 python macos pip anaconda

刚刚在 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包?

enter image description here

~/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/

相关文章:

mysql - 升级到 Mavericks,现在 python MySQL DB 出错

python - 自动添加已安装的 PIP 包到路径

Python GUI - 2.7 至 3.5

python - "OSError: [Errno 22] Invalid argument"读取一个大文件时

macos - 无法将本地奴隶连接到 AWS 上的 Jenkins 主人

python - 无法安装zbar

python - Python 对象是否在内部存储为字典?

python - Pandas 石斑鱼 vs 时间石斑鱼

python - 使用 boto3 从本地计算机连接到 AWS SNS。

macos - 从菜单项调用工作表