ImportError: cannot import name ReadTimeout

Python/PHP/Perl 开发与设计
回复
头像
九天星
帖子: 1347
注册时间: 2007-07-14 20:45
送出感谢: 67 次
接收感谢: 39 次

ImportError: cannot import name ReadTimeout

#1

帖子 九天星 » 2017-04-22 12:38

求助:ubuntu14.04运行python过程中的报错,在网上搜的很多方法都无效。我个人初步估可能是版本之间的问题。于是用

代码: 全选

wlp2s0@wlp2s0-computer:~$ pip list
adium-theme-ubuntu (0.3.4)
appdirs (1.4.3)
apt-xapian-index (0.45)
argparse (1.2.1)
asn1crypto (0.22.0)
backports-abc (0.5)
backports.ssl-match-hostname (3.5.0.1)
beautifulsoup4 (4.5.3)
blessings (1.6)
blinker (1.4)
certifi (2017.1.23)
cffi (1.10.0)
chardet (2.1.1)
cluster (1.1.1b3)
colorama (0.2.5)
command-not-found (0.3)
comtypes (1.1.3)
ConfigArgParse (0.11.0)
cryptography (1.8.1)
darts.util.lru (0.5)
debtagshw (0.1)
defer (1.0.6)
dirspec (13.10)
duplicity (0.6.23)
enum34 (1.1.6)
esmre (0.3.1)
Flask (0.10.1)
futures (2.1.5)
gitdb (0.6.4)
GitPython (0.3.2.RC1)
gnureadline (6.3.3)
guess-language (0.2)
halberd (0.2.4)
hpack (3.0.0)
html2text (2016.9.19)
html5lib (0.999)
httplib2 (0.8)
idna (2.5)
ipaddress (1.0.18)
itsdangerous (0.24)
Jinja2 (2.7.3)
lockfile (0.8)
lxml (3.4.4)
Markdown (2.6.1)
MarkupSafe (1.0)
mitmproxy (0.13)
msgpack-python (0.4.4)
ndg-httpsclient (0.3.3)
netlib (0.13.1)
nltk (3.0.1)
oauthlib (0.6.1)
oneconf (0.3.7.14.04.1)
packaging (16.8)
PAM (0.4.2)
paramiko (2.1.2)
passlib (1.7.1)
pdfminer (20140328)
pexpect (3.1)
phply (0.9.1)
Pillow (2.3.0)
pip (1.5.4)
piston-mini-client (0.7.5)
ply (3.10)
psutil (2.2.1)
pyasn1 (0.1.9)
pybloomfiltermmap (0.3.14)
pyClamd (0.3.15)
pycparser (2.17)
pycrypto (2.6.1)
pycryptodome (3.4.5)
pycups (1.9.66)
pycurl (7.19.3)
PyGithub (1.21.0)
pygobject (3.12.0)
pyOpenSSL (0.15.1)
pyparsing (2.2.0)
pyperclip (1.5.27)
pypng (0.0.18)
PyQRCode (1.2.1)
PyRIC (0.1.6.3)
pyserial (2.6)
pysmbc (1.0.14.1)
pysmi (0.1.2)
pysnmp (4.3.5)
python-apt (0.9.3.5ubuntu2)
python-debian (0.1.21-nmu2ubuntu2)
python-ntlm (1.0.1)
pywifi (1.1.8)
pyxdg (0.25)
PyYAML (3.12)
reportlab (3.0)
requests (2.2.1)
ruamel.ordereddict (0.4.8)
scapy-real (2.2.0-dev)
sessioninstaller (0.0.0)
setuptools (3.3)
singledispatch (3.4.0.3)
six (1.5.2)
smmap (0.9.0)
software-center-aptd-plugins (0.0.0)
system-service (0.1.6)
tabulate (0.7.7)
tblib (0.2.0)
termcolor (1.1.0)
terminaltables (3.1.0)
tldextract (1.7.2)
tornado (4.5)
Twisted-Core (13.2.0)
Twisted-Web (13.2.0)
unity-lens-photos (1.0)
urllib3 (1.7.1)
urwid (1.3.1)
vulndb (0.0.19)
Werkzeug (0.12.1)
wheel (0.24.0)
wifiphisher (1.3)
wsgiref (0.1.2)
xdiagnose (3.6.3build2)
xdot (0.6)
zim (0.60)
zope.interface (4.0.5)
同时也执行过

代码: 全选

wlp2s0@wlp2s0-computer:~$ sudo pip install requests --upgrade
[sudo] password for wlp2s0: 
Downloading/unpacking requests from https://pypi.python.org/packages/7e/ac/a80ed043485a3764053f59ca92f809cc8a18344692817152b0e8bd3ca891/requests-2.13.0-py2.py3-none-any.whl#md5=5e432dcf5bd1e3402ea1656700d99365
  Downloading requests-2.13.0-py2.py3-none-any.whl (584kB): 584kB downloaded
Installing collected packages: requests
  Found existing installation: requests 2.2.1
    Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed requests



问题一:

代码: 全选

wlp2s0@wlp2s0-computer:~/wxBot-master$ python bot.py
Traceback (most recent call last):
  File "bot.py", line 4, in <module>
    from wxbot import *
  File "/home/wlp2s0/wxBot-master/wxbot.py", line 18, in <module>
    from requests.exceptions import ConnectionError, ReadTimeout
ImportError: cannot import name ReadTimeout
问题二:

代码: 全选

wlp2s0@wlp2s0-computer:/opt/routersploit$ python rsf.py
Traceback (most recent call last):
  File "rsf.py", line 8, in <module>
    from routersploit.interpreter import RoutersploitInterpreter
  File "/opt/routersploit/routersploit/__init__.py", line 1, in <module>
    from routersploit.utils import (
  File "/opt/routersploit/routersploit/utils/__init__.py", line 40, in <module>
    requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)
AttributeError: 'module' object has no attribute 'packages'
头像
vickycq
论坛版主
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
送出感谢: 100 次
接收感谢: 995 次
联系:

Re: ImportError: cannot import name ReadTimeout

#2

帖子 vickycq » 2017-04-22 13:02

九天星 写了:wlp2s0@wlp2s0-computer:~$ sudo pip install requests --upgrade
[sudo] password for wlp2s0:
Downloading/unpacking requests from https://pypi.python.org/packages/7e/ac/ ... 6700d99365
Downloading requests-2.13.0-py2.py3-none-any.whl (584kB): 584kB downloaded
Installing collected packages: requests
Found existing installation: requests 2.2.1
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed requests
这里可能有问题。pip 并不会覆盖安装发行版包管理器的 python-requests 2.2.1。您可能需要按顺序执行以下指令

代码: 全选

sudo apt-get purge python-requests
sudo pip install requests --upgrade
这些用户感谢了作者 vickycq 于这个帖子:
九天星 (2017-04-22 13:14)
评价: 3.7%
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
头像
九天星
帖子: 1347
注册时间: 2007-07-14 20:45
送出感谢: 67 次
接收感谢: 39 次

Re: ImportError: cannot import name ReadTimeout

#3

帖子 九天星 » 2017-04-22 13:17

vickycq 写了:
九天星 写了:wlp2s0@wlp2s0-computer:~$ sudo pip install requests --upgrade
[sudo] password for wlp2s0:
Downloading/unpacking requests from https://pypi.python.org/packages/7e/ac/ ... 6700d99365
Downloading requests-2.13.0-py2.py3-none-any.whl (584kB): 584kB downloaded
Installing collected packages: requests
Found existing installation: requests 2.2.1
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed requests
这里可能有问题。pip 并不会覆盖安装发行版包管理器的 python-requests 2.2.1。您可能需要按顺序执行以下指令

代码: 全选

sudo apt-get purge python-requests
sudo pip install requests --upgrade
行了,谢谢你!
头像
九天星
帖子: 1347
注册时间: 2007-07-14 20:45
送出感谢: 67 次
接收感谢: 39 次

Re: ImportError: cannot import name ReadTimeout

#4

帖子 九天星 » 2017-04-22 13:21

代码: 全选

sudo apt-get purge python-requests
sudo pip install requests --upgrade
[/quote]


可以了,谢谢你!

再请教你一个问题,也是在执行PYTHON中出现的。
wlp2s0@wlp2s0-computer:/opt/routersploit$ python rsf.py
Traceback (most recent call last):
File "rsf.py", line 11, in <module>
log_handler = logging.handlers.RotatingFileHandler(filename='routersploit.log', maxBytes=500000)
File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/opt/routersploit/routersploit.log'
wlp2s0@wlp2s0-computer:/opt/routersploit$ cat /opt/routersploit/routersploit.log
cat: /opt/routersploit/routersploit.log: 没有那个文件或目录
头像
vickycq
论坛版主
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
送出感谢: 100 次
接收感谢: 995 次
联系:

Re: ImportError: cannot import name ReadTimeout

#5

帖子 vickycq » 2017-04-22 16:28

九天星 写了:wlp2s0@wlp2s0-computer:/opt/routersploit$ python rsf.py
logging.handlers.RotatingFileHandler(filename='routersploit.log',
IOError: [Errno 13] Permission denied: '/opt/routersploit/routersploit.log'
应用程序试图向 /opt/routersploit/routersploit.log 写入,但权限不足,访问被拒绝
根据 https://github.com/reverse-shell/router ... /README.md
rsf.py 需要以 root 身份运行
这些用户感谢了作者 vickycq 于这个帖子:
九天星 (2017-04-22 20:19)
评价: 3.7%
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复

回到 “Python/Php/Perl”