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

简介: 解决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.
>>> 


相关文章
|
Python Windows
升级pip并安装库
今天用pip安装一些常用库,然后出现以下这段代码。 需要升级一下pip
548 0
升级pip并安装库
|
3月前
|
Python
python pip升级3-3
python pip升级3-3
|
4月前
|
安全 IDE 开发工具
Python——记录pip问题(解决下载慢、升级失败问题)
Python——记录pip问题(解决下载慢、升级失败问题)
357 1
|
5月前
|
Shell Linux 网络安全
【Python】已完美解决:(pip提示升级)WARNING: There was an error checking the latest version of pip.,
【Python】已完美解决:(pip提示升级)WARNING: There was an error checking the latest version of pip.,
627 0
|
Java Linux Shell
centos7内网离线安装face_recognition、python、pip、CMake、dlib,离线升级gcc/切换gcc,文末有face_recognition的docker版本
公司项目需要人脸识别,本来app自带人脸识别,结果api支持的设备试了一圈就一个同事的华为Mate40Pro可以,所以使用无望。接着找了一下免费的java离线人脸识别sdk,发现虹软的确实简单好用,一会就在linux上弄好并测试通过了,然而在准备集成进去开写代码时,不小心看到了一眼首次激活需联网,后续方可离线使用,好吧,我们内网机器首次都不可能的,接着看了下离线激活方法,首先需要企业认证,这一步我们肯定没法做的,毕竟不是之前的小公司了,营业执照啥的随便给我肯定不行,直接放弃了。后来在同事推荐下看了下face_recognition这个项目,之前基本没用过python,于是有了漫长的踩坑之旅。
725 1
|
7月前
|
Python
在 Mac 上升级 pip
在 Mac 上升级 pip
107 0
|
Python
python环境部署:pip升级命令错误的解决方案
python环境部署:pip升级命令错误的解决方案
184 0
|
缓存 Shell Linux
pip升级之后出现的问题
pip升级之后出现的问题
135 0
|
Python
pip show pip可以查看pip的版本以及升级pip到最新版本
pip show pip可以查看pip的版本以及升级pip到最新版本
1485 0
|
Python Windows
升级pip 升级pip3的快速方法
升级pip 升级pip3的快速方法
828 0
升级pip 升级pip3的快速方法

热门文章

最新文章