问题:ERROR:Cannot uninstall enum34pyasn1-modules

mac2024-06-26  47

        下午安装了一下tensorflow:

$ sudo pip install tensorflow-gpu==1.4.0

        当然也可以提前把tensorflow下载下来,然后$ sudo pip install xxx.whl进行安装。

        在安装的过程中,报了如下的错误:

ERROR: Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

        如图所示:

         查了很多资料,很多说采用下面的指令进行解决:

$ sudo pip install --ignore-installed enum34

         但是这句话并没有解决问题,因为执行了这句话之后,前面的ERROR还是会出现。找到一个网站(这里),里面给出了一个解决方案:即找到enum34,删除即可。方法如下:

        (1)查找和enum34相关的路径:

$ sudo find / -name "*enum34*"

结果如下:

        (2)删除和enum34相关的.egg-info文件:

$ sudo rm -rf /usr/lib/python2.7/dist-packages/enum34-1.1.2.egg-info

        经过上述两个步骤之后,再安装tensorflow没有报错,问题解决。

 

        2020-6-1补充:

        在安装上tensorflow_gpu-2.0.0版本时:

sudo pip install tensorflow_gpu-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl

提示如下的错误:

 ERROR: Cannot uninstall 'pyasn1-modules'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

        解决方案:添加--ignore-installed即可,指令如下:

sudo pip install --ignore-installed pyasn1-modules tensorflow_gpu-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl

        这样就能解决该问题了!

 

最新回复(0)