python anaconda - 为不同的python版本管理模块

问题描述:

我在我的Anaconda中的mac(2.7和3.5.1)版本中有Python的2个版本。当我每个我python anaconda - 为不同的python版本管理模块

pip install xxx 

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

pip install aiohttp 

它会给我错误:

raise RuntimeError("aiohttp requires Python 3.4.1+") RuntimeError: aiohttp requires 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. 什么是管理PythonAnaconda的2个版本的最佳方法?
+0

如果您有Anaconda,为什么使用pip? –

+0

另外,请尝试'pip3 install aiohttp' –

+0

因为Anaconda没有'aiohttp'。 – sooon

一般来说,您可以创建新的环境,无论您需要什么样的项目,都可以使用任何python和packages。在这种特定的实例,如果你想使用需要较高蟒aiohttp,我会做到以下几点:

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

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

我只是找到了解决办法:

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

+1

你也可以尝试:'conda install -c pypi aiohttp' –

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

参见:https://www.continuum.io/content/python-3-support-anaconda了解更多信息。