Command "python setup.py egg_info" failed with error code 1
发布于 作者:苏南大叔 来源:程序如此灵动~
目前的python
社区里面,python2
和python3
还是共存的趋势。那么,在一台测试机上面,python2
和python3
同时存在的情况,依然会存在。在python2
和python3
共存的情况下,在使用pip2
或者pip3
安装库文件的时候,可能会出现这个很奇怪的错误信息。
本文的测试环境是:python2.7
和python3.7
。
错误描述
错误截图如下:
错误信息如下:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v4/0tj4yj2j5yscslqv4t0jjp8m0000gn/T/pip-install-_wrk06b5/dragnet/
解决方案
假如,苏南大叔要安装的python
库名字叫做<name>
的话,那么,正常来说,语句应该是下面这样的,但是可能会报错。
pip2 install <name>
pip3 install <name>
所以,您可能需要下面的变形语句。
sudo python2 -m pip install <name>
sudo python3 -m pip install <name>
注意替换<name>
字样,为你需要的python
库名。
总结
python2
和python3
混合的情况。还是非常复杂的。在本文中,解决方案就是,更改pip install
语句为-m pip install
。这个python
的pip
小技巧,您get
到了么?请点击下面的文章链接,获取更多python
新鲜资讯吧~


