Python 没有名为 setuptools 的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22531360/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No module named setuptools
提问by user2885082
I want to install setup file of twilio. When I install it through given command it is given me an error:
我想安装 twilio 的安装文件。当我通过给定的命令安装它时,它给了我一个错误:
No module named setuptools.
没有名为 setuptools 的模块。
Could you please let me know what should I do?
你能告诉我我该怎么做吗?
I am using python 2.7
我在用 python 2.7
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Python27>python D:\test\twilio-twilio-python-26f6707\setup.py install
Traceback (most recent call last):
File "D:\test\twilio-twilio-python-26f6707\setup.py", line 2, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
回答by Arvind
Install setuptoolsand try again.
安装并重setuptools试。
try command:
尝试命令:
sudo apt-get install -y python-setuptools
回答by Cees Timmerman
The PyPA recommendedtool for installing and managing Python packages is pip. pipis included with Python 3.4 (PEP 453), but for older versions here's how to installit (on Windows, using Python 3.3):
该PyPA推荐的用于安装和管理Python包的工具pip。pip包含在 Python 3.4 ( PEP 453) 中,但对于旧版本,这里是如何安装它(在 Windows 上,使用 Python 3.3):
Download https://bootstrap.pypa.io/get-pip.py
下载https://bootstrap.pypa.io/get-pip.py
>c:\Python33\python.exe get-pip.py
Downloading/unpacking pip
Downloading/unpacking setuptools
Installing collected packages: pip, setuptools
Successfully installed pip setuptools
Cleaning up...
Sample usage:
示例用法:
>c:\Python33\Scripts\pip.exe install pymysql
Downloading/unpacking pymysql
Installing collected packages: pymysql
Successfully installed pymysql
Cleaning up...
In your case it would be this (it appears that pipcaches independent of Python version):
在你的情况下是这样的(似乎pip缓存独立于 Python 版本):
C:\Python27>python.exe \code\Python\get-pip.py
Requirement already up-to-date: pip in c:\python27\lib\site-packages
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |################################| 69kB 255kB/s
Installing collected packages: wheel
Successfully installed wheel-0.29.0
C:\Python27>cd Scripts
C:\Python27\Scripts>pip install twilio
Collecting twilio
Using cached twilio-5.3.0.tar.gz
Collecting httplib2>=0.7 (from twilio)
Using cached httplib2-0.9.2.tar.gz
Collecting six (from twilio)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting pytz (from twilio)
Using cached pytz-2015.7-py2.py3-none-any.whl
Building wheels for collected packages: twilio, httplib2
Running setup.py bdist_wheel for twilio ... done
Stored in directory: C:\Users\Cees.Timmerman\AppData\Local\pip\Cache\wheels\e0\f2\a7\c57f6d153c440b93bd24c1243123f276dcacbf43cc43b7f906
Running setup.py bdist_wheel for httplib2 ... done
Stored in directory: C:\Users\Cees.Timmerman\AppData\Local\pip\Cache\wheels\e1\a3\e66aad1380335ee0a823c8f1b9006efa577236a24b3cb1eade
Successfully built twilio httplib2
Installing collected packages: httplib2, six, pytz, twilio
Successfully installed httplib2-0.9.2 pytz-2015.7 six-1.10.0 twilio-5.3.0
回答by Pila
For ubuntu users, this error may arise because setuptool is not installed system-wide. Simply install setuptool using the command:
对于 ubuntu 用户,可能会出现此错误,因为 setuptool 未在系统范围内安装。只需使用以下命令安装 setuptool:
sudo apt-get install -y python-setuptools
For python3:
对于python3:
sudo apt-get install -y python3-setuptools
After that, install your package again normally, using
之后,再次正常安装您的软件包,使用
sudo python setup.py install
That's all.
就这样。
回答by L053R
For Python Run This Command
对于 Python 运行此命令
apt-get install -y python-setuptools
For Python 3.
对于 Python 3。
apt-get install -y python3-setuptools

