pip安装Python包出现错误,easy_install可以安装
错误信息:Exception:Traceback(mostrecentcalllast):File"D:\ProgramFiles\Anaconda3\lib\site-...
错误信息:
Exception:
Traceback (most recent call last):
File "D:\Program Files\Anaconda3\lib\site-packages\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\commands\install.py", line 339, in run
requirement_set.prepare_files(finder)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\req\req_set.py", line 229, in prepare_files
req_to_install.check_if_exists()
File "D:\Program Files\Anaconda3\lib\site-packages\pip\req\req_install.py", line 931, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(self.req)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 461, in get_distribution
dist = get_provider(dist)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 341, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 870, in require
needed = self.resolve(parse_requirements(requirements))
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 740, in resolve
env = Environment(self.entries)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 927, in __init__
self.scan(search_path)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 957, in scan
self.add(dist)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 977, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: str() < NoneType() 展开
Exception:
Traceback (most recent call last):
File "D:\Program Files\Anaconda3\lib\site-packages\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\commands\install.py", line 339, in run
requirement_set.prepare_files(finder)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\req\req_set.py", line 229, in prepare_files
req_to_install.check_if_exists()
File "D:\Program Files\Anaconda3\lib\site-packages\pip\req\req_install.py", line 931, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(self.req)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 461, in get_distribution
dist = get_provider(dist)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 341, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 870, in require
needed = self.resolve(parse_requirements(requirements))
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 740, in resolve
env = Environment(self.entries)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 927, in __init__
self.scan(search_path)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 957, in scan
self.add(dist)
File "D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 977, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: str() < NoneType() 展开
展开全部
pip安装Python包出现错误是可能是系统没有更新或者出现了bug。
解决方法:
在unix和macos,配置文件为:$HOME/.pip/pip.conf,在windows上,配置文件为:%HOME%\pip\pip.ini。
把所有要安装的包写在一个文件里面,比如requirement.txt(每个包写一行,顶行头写),然后pip安装的时候只需要加参数“-r requirement.txt”即可。
进入目录下使用命令:virtualenv env。
source env/bin/activate,这时候你会发现命令行前面会多出个(env)标识,这表明你已经进入了虚拟环境了。
写个简单的hello.py验证:#!/usr/bin/pythonfrom flask import Flaskapp = Flask(__name__)
@app.route('/', methods = ['GET', 'POST'])def hello():return 'Hello world!'if __name__ == '__main__':app.run(),就可以了。
展开全部
这是python3.4吗?
网上找到的是要替换文件D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py
你先把这个文件备份一下,然后用这个网页下的文件进行替换
https://bitbucket.org/minrk/setuptools/src/e7d8f68ea7c603638562cf8278daa5d16e699f4e/pkg_resources/__init__.py
不过我还没实践过,楼主小心点测试吧。
网上找到的是要替换文件D:\Program Files\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py
你先把这个文件备份一下,然后用这个网页下的文件进行替换
https://bitbucket.org/minrk/setuptools/src/e7d8f68ea7c603638562cf8278daa5d16e699f4e/pkg_resources/__init__.py
不过我还没实践过,楼主小心点测试吧。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-04-11 · 知道合伙人软件行家
老夭来了
知道合伙人软件行家
向TA提问 私信TA
知道合伙人软件行家
采纳数:1806
获赞数:8100
2008年从事软件开发,拥有多年的python,php,linux工作经验,发布过多个python,php的开源项目。
向TA提问 私信TA
关注
展开全部
这个应该是pip版本和python版本兼容造成的,你可以升级下pip,或者升级下python。
这个是官方出的bug:https://github.com/pypa/pip/issues/2357
如果解决了您的问题请采纳!
如果未解决请继续追问
这个是官方出的bug:https://github.com/pypa/pip/issues/2357
如果解决了您的问题请采纳!
如果未解决请继续追问
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询