尝试 运行 BioPython 测试时出现解析 sys.version 错误

Getting error parsing sys.version when try to run BioPython tests

在装有 python 2.7.14 的机器上安装了 BioPython 1.70。想要通过 运行ning 测试来验证设置。

$ python run_tests.py
Traceback (most recent call last):
  File "run_tests.py", line 148, in <module>
    if is_numpy():
  File "run_tests.py", line 63, in is_numpy
    if is_pypy():
  File "run_tests.py", line 54, in is_pypy
    if platform.python_implementation() == 'PyPy':
  File "/home/foo/python/lib/python2.7/platform.py", line 1460, in python_implementation
    return _sys_version()[0]
  File "/home/foo/python/lib/python2.7/platform.py", line 1422, in _sys_version
    repr(sys_version))
ValueError: failed to parse CPython sys.version: '2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 17:05:42) \n[GCC 7.2.0]'

如果我想要 运行 任何测试,是否必须编辑 /home/foo/python/lib/python2.7/platform.py?

原来是我的 PYTHONPATH 问题。

~/anaconda2/lib/python2.7 需要放在第一位。我之前有 ~/lib/python,所以它使用了错误的 platform.py 文件。