1

我的 Anaconda 中有 2 个版本的Pythonmac(2.7 和 3.5.1)。当每一个我

pip install xxx

它会自动进入/anaconda/lib/python2.7/site-packages文件夹。现在我想学习aiohttp,当我安装它时

pip install aiohttp

它会给我错误:

raise RuntimeError("aiohttp 需要 Python 3.4.1+") RuntimeError: aiohttp 需要 Python 3.4.1+

---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in

/private/var/folders/c2/3yxfnvc51fng531jz312t00m0000gn/T/pip-build-m_mCpM/aiohttp/

  1. 我该如何解决这个问题?
  2. Python管理in的 2 个版本的最佳方法是Anaconda什么?
4

3 回答 3

0

您可以使用conda工具来管理您的环境(对于 Python2/Python3)和包。

有关更多信息,请参阅:https ://www.continuum.io/content/python-3-support-anaconda。

于 2016-04-29T13:25:50.287 回答
0

通常,您可以使用所需的任何 python 和包为您正在处理的任何项目创建新环境。在这个特定的例子中,如果你想使用需要更高级别 python 的 aiohttp,我会这样做:

conda create -n py35 python=3.5
source activate py35
pip install aiohttp

这将在您的 py35 环境中安装 aiohttp。

于 2016-04-29T13:24:49.663 回答
0

我刚刚找到了解决方案:

python2   -m pip install SomePackage  # default Python 2
python2.7 -m pip install SomePackage  # specifically Python 2.7
python3   -m pip install SomePackage  # default Python 3
python3.4 -m pip install SomePackage  # specifically Python 3.4

来自python.org

于 2016-04-29T13:20:54.880 回答