Anaconda 包更新故障集锦(持续更新)

Posted lxr1995

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Anaconda 包更新故障集锦(持续更新)相关的知识,希望对你有一定的参考价值。

1. 用pip安装包keras,报错误信息 TypeError: string argument expected, got ‘NoneType‘

  • PS C:\Users\GoFree> pip install keras --upgrade # 包更新语句
    Collecting keras
      Downloading https://files.pythonhosted.org/packages/54/e8/eaff7a09349ae9bd40d3ebaf028b49f5e2392c771f294910f75bb608b241/Keras-2.1.6-py2.py3-none-any.whl (339kB)
        100% |████████████████████████████████| 348kB 9.8kB/s
    Requirement not upgraded as not directly required: pyyaml in c:\users\gofree\anaconda3\lib\site-packages (from keras) (3.12)
    Requirement not upgraded as not directly required: scipy>=0.14 in c:\users\gofree\anaconda3\lib\site-packages (from keras) (1.1.0)
    Requirement not upgraded as not directly required: numpy>=1.9.1 in c:\users\gofree\anaconda3\lib\site-packages (from keras) (1.14.3)
    Requirement not upgraded as not directly required: h5py in c:\users\gofree\anaconda3\lib\site-packages (from keras) (2.7.1)
    Exception:
    Traceback (most recent call last):
      File "c:\users\gofree\anaconda3\lib\site-packages\pip\_internal\basecommand.py", line 228, in main
        status = self.run(options, args)
      File "c:\users\gofree\anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 291, in run
        resolver.resolve(requirement_set)
      File "c:\users\gofree\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 103, in resolve
        self._resolve_one(requirement_set, req)
      File "c:\users\gofree\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 262, in _resolve_one
        check_dist_requires_python(dist)
      File "c:\users\gofree\anaconda3\lib\site-packages\pip\_internal\utils\packaging.py", line 46, in check_dist_requires_python
        feed_parser.feed(metadata)
      File "c:\users\gofree\anaconda3\lib\email\feedparser.py", line 175, in feed
        self._input.push(data)
      File "c:\users\gofree\anaconda3\lib\email\feedparser.py", line 103, in push
        self._partial.write(data)
    TypeError: string argument expected, got ‘NoneType‘ # 错误信息
    PS C:\Users\GoFree>

 

  • 故障解决方法(不一定成功):
    • 1.  (推荐) 将这个需要更新的包,强制卸载重安装。命令如下:
      • python -m pip install -U --force-reinstall keras
    • 2.  手动下载更新包。 下载地址: https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted    ,  https://pypi.org/。  以上两个都可以下载:
      • . whl更新包的安装:(例如,要安装包ad3,  下载目录为 : E:\  ,安装包名为 :ad3-2.1-cp36-cp36m-win_amd64.whl注意:36代表python3.6, amd64 代表 64位,不同系统要下载对应的最新包。
        • PS C:\Users\GoFree> cd E:PS E:\> pip install .\Keras-2.1.6-py2.py3-none-any.whl
      •  普通压缩包安装:安装包为 Keras-2.1.6.tar.gz
        • 先解压缩文件Keras-2.1.6 到  E:\  
        • 安装
          PS C:\Users\GoFree> cd E:\Keras-2.1.6
          PS E:\Keras-2.1.6> python .\setup.py install
    • 3 . conda 安装
      • PS E:\Keras-2.1.6> conda install keras


        Package plan for installation in environment C:\Users\GoFree\Anaconda3:

        The following NEW packages will be INSTALLED:

            backports.weakref: 1.0rc1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
            keras:             2.1.6-py36_0  defaults
            libprotobuf:       3.2.0-vc14_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
            markdown:          2.6.9-py36_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
            protobuf:          3.2.0-py36_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
            tensorflow:        1.2.1-py36_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

        Proceed ([y]/n)? y

        PS E:\Keras-2.1.6>

 

  • 最后,三种方法都尝试后,方法3:conda安装 成功安装了包keras .
    PS E:\Keras-2.1.6> conda update keras
    
    
    # All requested packages already installed.
    # packages in environment at C:\Users\GoFree\Anaconda3:
    #
    keras                     2.1.6                    py36_0    defaults
    PS E:\Keras-2.1.6>

 

  

以上是关于Anaconda 包更新故障集锦(持续更新)的主要内容,如果未能解决你的问题,请参考以下文章

开源项目集锦(持续更新)...

实用工具集锦(持续更新)

python各种错误提示集锦,持续更新中~

Xamarin.Forms踩坑集锦(持续更新)

关于gpu版本的tensorflow+anaconda+jupyter的一些安装问题(持续更新)

JavaEE进阶集锦(持续更新中)