1

我今天收到此错误,之前工作正常。

ImportError: cannot import name ceil_shift

我只有:

#!/usr/bin/python -W ignore::UserWarning
import urllib;
import urllib2;
import hashlib;
import simplejson as json;
import subprocess;
import smtplib;
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import ssh;

- - 结果:

Traceback (most recent call last):
  File "./api.py", line 2, in <module>
    from maborak import maborak
  File "/root/automated/maborak.py", line 10, in <module>
    import ssh;
  File "/usr/lib/python2.6/site-packages/ssh/__init__.py", line 62, in <module>
    from transport import SecurityOptions, Transport
  File "/usr/lib/python2.6/site-packages/ssh/transport.py", line 33, in <module>
    from ssh import util
  File "/usr/lib/python2.6/site-packages/ssh/util.py", line 33, in <module>
    from ssh.common import *
  File "/usr/lib/python2.6/site-packages/ssh/common.py", line 98, in <module>
    from Crypto import Random
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
    from Crypto.Util.number import ceil_shift, exact_log2, exact_div
ImportError: cannot import name ceil_shift

这很奇怪,因为代码在 1 天前就可以工作。

谢谢你。

4

1 回答 1

0

代表 OP 发布:

该错误已通过以下方式修复:

pip -v uninstall ssh
pip -v uninstall pycrypto

pip -v install pycrypto --upgrade
pip -v install ssh --upgrade
于 2013-05-11T14:07:31.547 回答