解决pip无法升级以及PyHamcrest无法安装问题

遇到问题

最近调试PaddlePaddle调试语音转写及TTS功能。Paddle需要安装要求pip版本为20.2.2或更高版本。还需要安装PyHamcrest。

但是目前访问pip的官网非常的慢,更新几乎完成不了。

采用python -m ensurepip,但是报如下错误:

twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed

解决方法:

采用pip install pip -U,解决pip版本升级问题

[root@system-2-new bin]# pip install pip -U
Collecting pip
  Downloading https://files.pythonhosted.org/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl (2.1MB)
    100% |████████████████████████████████| 2.1MB 12.4MB/s 
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-22.0.3

设置清华镜像,解决PyHamcrest包安装问题

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

[root@system-2-new bin]# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PyHamcrest

[root@system-2-new bin]# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PyHamcrest
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PyHamcrest
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/fa/488920633f45c1c291c633fcbe0cd465f40d91ac2a2b90f594bae36db80a/PyHamcrest-2.0.3-py3-none-any.whl (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.9/51.9 KB 6.0 MB/s eta 0:00:00
Installing collected packages: PyHamcrest
Successfully installed PyHamcrest-2.0.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[root@system-2-new bin]# python -m ensurepip
Looking in links: /tmp/tmps785zwtp
Requirement already satisfied: setuptools in /usr/anaconda3/lib/python3.7/site-packages (40.2.0)
Requirement already satisfied: pip in /usr/anaconda3/lib/python3.7/site-packages (22.0.3)

最后顺利安装paddle(飞桨)

[paddle@system-2-new ~]$ python -m pip install paddlepaddle==2.2.2 -i https://mirror.baidu.com/pypi/simple
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://mirror.baidu.com/pypi/simple
Collecting paddlepaddle==2.2.2
  Using cached https://mirror.baidu.com/pypi/packages/e4/42/3a91bff89038a9773b2df69610293e759ed6e1de6fe115503d1132805103/paddlepaddle-2.2.2-cp37-cp37m-manylinux1_x86_64.whl (108.4 MB)
Requirement already satisfied: decorator in /usr/anaconda3/lib/python3.7/site-packages (from paddlepaddle==2.2.2) (4.3.0)
Requirement already satisfied: Pillow in /usr/anaconda3/lib/python3.7/site-packages (from paddlepaddle==2.2.2) (5.2.0)
Collecting requests>=2.20.0
  Using cached https://mirror.baidu.com/pypi/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl (63 kB)
Requirement already satisfied: six in /usr/anaconda3/lib/python3.7/site-packages (from paddlepaddle==2.2.2) (1.11.0)
Collecting astor
  Using cached https://mirror.baidu.com/pypi/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl (27 kB)
Requirement already satisfied: numpy>=1.13 in /usr/anaconda3/lib/python3.7/site-packages (from paddlepaddle==2.2.2) (1.15.1)
Collecting protobuf>=3.1.0
  Downloading https://mirror.baidu.com/pypi/packages/03/6b/12b307892ef5e9f4a1a92f5996922561c453540f5ce22a09038d2486b451/protobuf-3.19.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 6.1 MB/s eta 0:00:00
Requirement already satisfied: idna<4,>=2.5 in /usr/anaconda3/lib/python3.7/site-packages (from requests>=2.20.0->paddlepaddle==2.2.2) (2.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/anaconda3/lib/python3.7/site-packages (from requests>=2.20.0->paddlepaddle==2.2.2) (1.23)
Collecting charset-normalizer~=2.0.0
  Using cached https://mirror.baidu.com/pypi/packages/06/b3/24afc8868eba069a7f03650ac750a778862dc34941a4bebeb58706715726/charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Requirement already satisfied: certifi>=2017.4.17 in /usr/anaconda3/lib/python3.7/site-packages (from requests>=2.20.0->paddlepaddle==2.2.2) (2018.8.24)
Installing collected packages: protobuf, charset-normalizer, astor, requests, paddlepaddle
Successfully installed astor-0.8.1 charset-normalizer-2.0.12 paddlepaddle-2.2.2 protobuf-3.19.4 requests-2.27.1
[paddle@system-2-new ~]$ ls
fast_install.sh
[paddle@system-2-new ~]$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42) 
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
/usr/anaconda3/lib/python3.7/site-packages/socks.py:58: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Callable
/usr/anaconda3/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py:943: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  collections.MutableMapping.register(ParseResults)
/usr/anaconda3/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py:3245: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  elif isinstance( exprs, collections.Iterable ):
/usr/anaconda3/lib/python3.7/site-packages/setuptools/depends.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
PaddlePaddle works well on 1 CPU.
W0224 14:09:04.475348  8147 fuse_all_reduce_op_pass.cc:76] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 2.
PaddlePaddle works well on 2 CPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
>>> 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

醉心编码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值