Python小技巧之“missing in current channels”问题解决

感谢CSDN
ZeroZone零域 的文章:
Anaconda找包,安装包时,遇到PackageNotFoundError: ”Package missing in current channels”

以及 CSDN
神马呵呵哒 的文章
如何给Python安装.whl文件 – weixin_41592575的博客 – CSDN博客

在import talib时,系统报错

No module named 'talib'

需要安装 talib 包,但是如果直接在 anaconda promt里面打:

$ conda install talib

系统会报:

PackageNotFoundError: Packages missing in current channels:

这个时候,需要首先查一下anaconda可以安装的包都有哪些:

$ anaconda search -t conda TA-Lib
Using Anaconda API: https://api.anaconda.org
Packages:
     Name                      |  Version | Package Types   | Platforms       | Builds
     ------------------------- |   ------ | --------------- | --------------- | ----------
     Quantopian/ta-lib         |    0.4.9 | conda           | linux-64, win-32, win-64, osx-64 | np111py27_0, np111py35_0, np18py33_0, np111py34_0, np19py33_0, np19py27_0, np18py27_0, np114py35_0, np110py34_0, np19py34_0, np110py27_0
     cio-test/ta-lib           |    0.4.9 | conda           | linux-64        | np110py27_0
     developer/ta-lib          |    0.4.9 | conda           | linux-64, osx-64 | py35_0
     dkossack/ta-lib           |    0.4.8 | conda           | osx-64          | nppy34_0
     jaikumarm/ta-lib          |    0.4.9 | conda           | linux-64        | py35_0, py27_0
                                          : Python wrapper for TA-Lib
     jiayi_anaconda/ta-lib     |   0.4.17 | conda           | linux-64        | py36_0
                                          : Python wrapper for TA-Lib
     lei09247/ta-lib           |    0.4.9 | conda           | linux-64        | np111py27_0
     llllllllll/ta-lib         |    0.4.8 | conda           | linux-64        | py34_0
     masdeseiscaracteres/TA-Lib |   0.4.17 | conda, pypi     | win-64          | py36_0, py35_0
     r2d2/ta-lib               |    0.4.8 | conda           | win-64          | np19py27_0
     ssanderson/ta-lib         |          | conda           | linux-64        | np111py27_0
     twiecki/ta-lib            |    0.4.8 | conda           | linux-64        | np18py27_0, py33_0, py27_0
Found 12 packages

Run 'anaconda show <USER/PACKAGE>' to get installation details

我们可以选择某个包,查看具体的信息:

$ anaconda show Quantopian/ta-lib

Using Anaconda API: https://api.anaconda.org
Name:    ta-lib
Summary:
Access:  public
Package Types:  conda
Versions:
   + 0.4.8
   + 0.4.9

To install this package with conda run:
     conda install --channel https://conda.anaconda.org/Quantopian ta-lib

复制最后一句,粘贴后运行:

$ conda install --channel https://conda.anaconda.org/Quantopian ta-lib

UnsatisfiableError: The following specifications were found to be in conflict:
  - python 3.6*
  - ta-lib -> python 3.4*
Use "conda info <package>" to see the dependencies for each package.

版本不对,那么尝试下载whl安装,下载链接:Python Extension Packages for Windows

我用的python 3.6 下载 TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl后放到D盘anaconda scripts文件夹下,然后prompt里面用cd命令跳到该文件夹下:

(D:\Anaconda3) C:\Users\x>cd D:\Anaconda3\Scripts

(D:\Anaconda3) C:\Users\x>d:

(D:\Anaconda3) D:\Anaconda3\Scripts> pip install TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl
Processing d:\anaconda3\scripts\ta_lib-0.4.17-cp36-cp36m-win_amd64.whl
Installing collected packages: TA-Lib
Successfully installed TA-Lib-0.4.17

显示已安装成功

    原文作者:玩儿基金的浩然歌
    原文地址: https://zhuanlan.zhihu.com/p/49442927
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞