在python 2.5中导入termcolor时出错

时间:2014-08-26 05:40:28

标签: python importerror python-2.5 lenny

我在lenny-5 64位版本上使用python 2.5。我以前安装了termcolor并且也使用过它。突然间,我现在无法使用它。我收到import termcolor的错误:

>>> import termcolor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "termcolor.py", line 124
    print((colored(text, color, on_color, attrs)), **kwargs)
                                                ^
SyntaxError: invalid syntax

我不知道是否通过安装其他模块来违反任何约束或依赖。我甚至不知道这个lib发生了什么。有什么想法吗?

我尝试使用pip重新安装此软件包,我得到了这个:

# pip uninstall termcolor
Cannot uninstall requirement termcolor, not installed
Storing complete log in /root/.pip/pip.log

我尝试使用pip安装它,我得到了这个:

 # pip install termcolor
Downloading/unpacking termcolor
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/commands/install.py", line 266, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/req.py", line 1026, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 125, in find_requirement
page = self._get_page(main_index_url, req)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 353, in _get_page
    return HTMLPage.get_page(link, req, cache=self.cache)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/index.py", line 471, in get_page
    resp = urlopen(url)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/download.py", line 143, in __call__
    response = self.get_opener(scheme=scheme).open(url)
  File "/usr/lib/python2.5/site-packages/pip-1.3-py2.5.egg/pip/download.py", line 201, in get_opener
        raise NoSSLError()
NoSSLError:
###################################################################
##  You don't have an importable ssl module. You are most        ##
##  likely using Python 2.5, which did not include ssl           ##
##  support by default. In this state, we can not provide        ##
##  ssl certified downloads from PyPI.                           ##
##                                                               ##
##  You can do one of 2 things:                                  ##
##   1) Install this: https://pypi.python.org/pypi/ssl/          ##
##      (It provides ssl support for older Pythons )             ##
##   2) Use the --insecure option to allow this insecurity       ##
##                                                               ##
##  For more details, go to the  "SSL Certificate Verification"  ##
##  section located here:                                        ##
##     http://www.pip-installer.org/en/latest/logic.html         ##
##                                                               ##
###################################################################


Storing complete log in /root/.pip/pip.log

我尝试easy_install再次安装它;这是输出:

# easy_install termcolor
Searching for termcolor
Reading http://pypi.python.org/simple/termcolor/
Best match: termcolor 1.1.0
Downloading https://pypi.python.org/packages/source/t/termcolor/termcolor-1.1.0.tar.gz#md5=043e89644f8909d462fbbfa511c768df
Processing termcolor-1.1.0.tar.gz
Running termcolor-1.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-YzwLtr/termcolor-1.1.0/egg-dist-tmp-GfHcKR
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1712, in main
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1716, in <lambda>
  File "/usr/lib/python2.5/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.5/distutils/dist.py", line 994, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 211, in run
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in <lambda>
  File "setup.py", line 35, in <module>
    from termcolor import VERSION
  File "/tmp/easy_install-YzwLtr/termcolor-1.1.0/termcolor.py", line 124
    print((colored(text, color, on_color, attrs)), **kwargs)
                                                ^
SyntaxError: invalid syntax

0 个答案:

没有答案