【原】执行nosetests 报错:pkg_resources.DistributionNotFound: nose==0.10.4

我的系统是centos6.3,安装好nose1.3.4之后,执行nosetests,提示异常如下:

1 # nosetests
2 Traceback (most recent call last):
3   File "/usr/bin/nosetests", line 5, in <module>
4     from pkg_resources import load_entry_point
5   File "/usr/local/python/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/pkg_resources.py", line 2659, in <module>
6     parse_requirements(__requires__), Environment()
7   File "/usr/local/python/lib/python2.7/site-packages/distribute-0.6.10-py2.7.egg/pkg_resources.py", line 546, in resolve
8     raise DistributionNotFound(req)
9 pkg_resources.DistributionNotFound: nose==0.10.4

 

本想像之前解决下面这个问题一样:下载distribute的0.6.10版本进行安装,但是在官网上竟然没有找到nose的0.10.4版本……

后来将/usr/bin/nosetests里面的内容改了以后可以用了

/usr/bin/nosetests的内容现在是这样的:

 1 #!/usr/bin/python
 2     # EASY-INSTALL-ENTRY-SCRIPT: 'nose==0.10.4','console_scripts','nosetests'
 3 
 4 __requires__ = 'nose==0.10.4'
 5 import sys
 6 from pkg_resources import load_entry_point
 7 
 8 if __name__ == '__main__':
 9     sys.exit(
10         load_entry_point('nose==0.10.4', 'console_scripts', 'nosetests')()
11     )

 

  把里面所有的nose==0.10.4改为你机器上现在安装上的nose版本,比如我的安装的1.3.4就把所有的 nose==0.10.4——> nose==1.3.4

 

其实在用上面的方法解决问题之前,走了很多的弯路……最后,突发奇想去把文件中的版本号替换了……

有时间要尝试下之前遇到的这些问题是不是也可以这样解决:

1 # easy_install
2 Traceback (most recent call last):
3   File "/usr/bin/easy_install", line 5, in <module>
4     from pkg_resources import load_entry_point
5   File "/usr/local/python/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
6     parse_requirements(__requires__), Environment()
7   File "/usr/local/python/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
8     raise DistributionNotFound(req)
9 pkg_resources.DistributionNotFound: distribute==0.6.10
1 # pip
2 Traceback (most recent call last):
3   File "/usr/bin/pip", line 5, in <module>
4     from pkg_resources import load_entry_point
5   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2712, in <module>
6   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 668, in require
7   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 571, in resolve
8 pkg_resources.DistributionNotFound: pip==1.3.1

 

posted on 2014-12-31 11:56  随意地行走  阅读(5111)  评论(0编辑  收藏  举报

导航