【pip】使用笔记

基础

常用命令

更新pip版本:python -m pip install --upgrade pip

同时安装多个包:pip install TensorFlow pygame ipython

列出过期的包:pip list --outdated

更新:pip install --upgrade 包名

pip-review

pip-review is a convenience wrapper around pip. It can list available updates by deferring to pip list --outdated. It can also automatically or interactively install available updates for you by deferring to pip install.

查看可更新 pip-review

自动批量升级 pip-review --auto

以交互方式运行,对每个包进行升级 pip-review --interactive

错误及解决

install

关于python安装库,可先查看官方教程:https://packaging.python.org/tutorials/installing-packages/

马大哈aip

pip install aip 报错【Windows,python3.6】

ERROR: Could not find a version that satisfies the requirement aip (from versions: none)
ERROR: No matching distribution found for aip

 【解决】【pip install baidu-aip】

老大难aubio

pip intall aubio 报错 【Windows 10,python3.7.6】

Installing collected packages: numpy, aubio
    Running setup.py install for aubio ... error

加上清华镜像,下载安装numpy无误,下载aubio无误,安装aubio继续报错

Installing collected packages: aubio
    Running setup.py install for aubio ... error

出现ERROR具体处有:

ERROR: Command errored out with exit status 1:
…一串之后…
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

查看过期包,发现setuptools过期,用pip install --upgrade setuptools更新完,重新安装aubio,报错依旧。

参考CSDN博客,在https://pypi.org/project/aubio/0.4.3a2/#files下载aubio-0.4.3a2-cp35-cp35m-win_amd64.whl,然后进入对应文件夹,用pip install aubio-0.4.3a2-cp35-cp35m-win_amd64.whl,报错:

ERROR: aubio-0.4.3a2-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

参考CSDN博客,直接将whl名称改为aubio-0.4.3a2-cp35-none-win_amd64.whl,仍然报错:

ERROR: aubio-0.4.3a2-cp35-none-win_amd64.whl is not a supported wheel on this platform.

安装wheel模块后,参考cnblogs博客,查询当前pip支持的文件版本号如下:

sys.version_info < (3, 8))) \
[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('cp36', 'none', 'any'), ('cp35', 'none', 'any'), ('cp34', 'none', 'any'), ('cp33', 'none', 'any'), ('cp32', 'none', 'any'), ('cp31', 'none', 'any'), ('cp30', 'none', 'any'), ('py3', 'none', 'win_amd64'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

重新pip安装,报错依旧。突发奇想,将上述whl名称改为aubio-0.4.3a2-cp37-cp37m-win_amd64.whl,然后pip安装,成功!但是import失败,说明版本不匹配还是不行??

但是因为下载的实际为cp35版本的,不知道会不会有隐患。所以有unsintall了上述whl,又下载了最新版的aubio-0.4.9源码,python setup.py install 安装,然后报错:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

以为是编码的问题,修改HPCP,重复上述安装,报错:

...\python\python37\scripts\aubio-0.4.9\python\ext\aubio-types.h(5): fatal error C1083: 无法打开包括文件: “aubio-generated.h”: No such file or directory
error: command 'F:\\zhaoqin\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

崩溃之后,找到两个貌似有用的链接https://blog.csdn.net/lying_byr/article/details/92802719 https://stackoverflow.com/questions/40018405/cannot-open-include-file-io-h-no-such-file-or-directory/50210015#50210015

在VS2017上重新下载了相关组件。添加了两个环境变量:……\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64  和 ……2017\Community\Common7\IDE  ,报错信息不变。

【目前,删除了VS2017,暂不安装aubio】

参考

1、关于pip工具的一些用法

2、待看待尝试:https://blog.csdn.net/ViMan1204/article/details/89715375

posted @ 2019-12-23 18:38  Skye_Zhao  阅读(489)  评论(0编辑  收藏  举报