【发布时间】:2016-05-05 17:11:37
【问题描述】:
我正在尝试为 python 安装模块 aiohttp,以便我可以设置一个系统来使用 uvloop 下载文件。但是,当我进入将 aiohttp 提取到的文件夹并执行以下命令时,我遇到了一些困难:
sudo python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup, Extension
ImportError: No module named 'setuptools'
我环顾四周,发现有些人遇到了这个问题,但通过获取 python-setuptools 或 python3-setuptools 包解决了这个问题。所以我尝试这样做,但这是我得到的输出:
$ sudo apt-get install python3-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-setuptools is already the newest version.
python3-setuptools set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
$ sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-setuptools is already the newest version.
python-setuptools set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
这让我相信 python-setuptools 已经安装了!我不知道从这里去哪里。为了清楚起见,我确实尝试过
sudo python setup.py install
但我收到一个错误,因为安装 aiohttp 需要 Python 3.4.1+:
sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 61, in <module>
raise RuntimeError("aiohttp requires Python 3.4.1+")
RuntimeError: aiohttp requires Python 3.4.1+
我在 HP Elitebook 8440p 上运行 Linux Mint 17.2 Qiana。关于我应该做什么的任何建议? 提前致谢!
【问题讨论】:
-
您确定
apt-get install python3-setuptools正在为python3 所指的同一个python 版本做这件事吗?你试过pip3 install setuptools吗? -
感谢您这么快回来!这是我为该命令获得的输出:(我不知道如何让这些东西不内联......帮助?)
sudo pip3 install setuptools Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python3.4/dist-packages Cleaning up... -
在这种情况下尝试运行
python3,并在交互式会话中尝试import setuptools,如果失败,请务必查看带有import sys ; print(sys.version)的版本 -
所以一个使用 3.4,另一个使用 3.4,所以只需使用
pip3.5 install setuptools然后python3.5以确保它们是相同的版本。 -
pip安装可以参考pip.pypa.io/en/stable/installing。
标签: python python-3.x setuptools aiohttp