报错内容如下
[root@www Python-3.7.3]# pip install virtualenvwrapper
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting virtualenvwrapper
Using cached virtualenvwrapper-4.8.4.tar.gz (334 kB)
Requirement already satisfied: virtualenv in /usr/lib/python2.7/site-packages (from virtualenvwrapper) (20.14.1)
Collecting virtualenv-clone
Using cached virtualenv-clone-0.5.7.tar.gz (6.5 kB)
ERROR: Command errored out with exit status 1:
command: /bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gKdJeT/virtualenv-clone/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gKdJeT/virtualenv-clone/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-B9Q9yQ
cwd: /tmp/pip-install-gKdJeT/virtualenv-clone/
Complete output (19 lines):
解决方式
1、首先升级
pip install -U pip setuptools
2、查看环境,在使用pip install时,要知道究竟用的那个pip,在PATH、shell 配置和操作系统等里设置都会影响到pip的使用
最好的办法是使用 -m pipwhere是指定安装路径的Python 来调用 pip。例如,用的是python3,则运行python3 -m pip 包名
python3 -m pip install virtualenvwrapper
如果在服务器上运行python3 -m pip install 时提示权限错误,可以 --用户 添加有权限的用户去安装,例如,python3 -m pip install --user …,把包安装到指定用户下,并使当前操作用户可去执行使用。
安装成功则如下:
[root@www Python-3.7.3]# python3 -m pip install virtualenvwrapper
Collecting virtualenvwrapper
Using cached https://files.pythonhosted.org/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz
Collecting virtualenv (from virtualenvwrapper)
Using cached https://files.pythonhosted.org/packages/9e/34/e86fc6a8f84329b49321a532b3c1fef103c67765df957fbb3852eea39d00/virtualenv-20.14.1-py2.py3-none-any.whl
Collecting virtualenv-clone (from virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/21/ac/e07058dc5a6c1b97f751d24f20d4b0ec14d735d77f4a1f78c471d6d13a43/virtualenv_clone-0.5.7-py3-none-any.whl
Collecting stevedore (from virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/7a/bc/fcce9e50da73ea23af6d236e05e15db8a02da1099a5e0a479451bcea3833/stevedore-3.5.0-py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 9.1MB/s
Collecting platformdirs<3,>=2 (from virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/ed/22/967181c94c3a4063fe64e15331b4cb366bdd7dfbf46fcb8ad89650026fec/platformdirs-2.5.2-py3-none-any.whl
Collecting distlib<1,>=0.3.1 (from virtualenv->virtualenvwrapper)
Using cached https://files.pythonhosted.org/packages/ac/a3/8ee4f54d5f12e16eeeda6b7df3dfdbda24e6cc572c86ff959a4ce110391b/distlib-0.3.4-py2.py3-none-any.whl
Collecting six<2,>=1.9.0 (from virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting filelock<4,>=3.2 (from virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/a6/d5/17f02b379525d1ff9678bfa58eb9548f561c8826deb0b85797aa0eed582d/filelock-3.7.1-py3-none-any.whl
Collecting importlib-metadata>=0.12; python_version < "3.8" (from virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/ab/b5/1bd220dd470b0b912fc31499e0d9c652007a60caf137995867ccc4b98cb6/importlib_metadata-4.11.4-py3-none-any.whl
Collecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)
Using cached https://files.pythonhosted.org/packages/1b/ef/0621aa0e422dda72dc89b61972e5a28d5a947c22fdff83a5d69fdbc1949a/pbr-5.9.0-py2.py3-none-any.whl
Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata>=0.12; python_version < "3.8"->virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata>=0.12; python_version < "3.8"->virtualenv->virtualenvwrapper)
Downloading https://files.pythonhosted.org/packages/80/0e/16a7ee38617aab6a624e95948d314097cc2669edae9b02ded53309941cfc/zipp-3.8.0-py3-none-any.whl
Installing collected packages: platformdirs, distlib, six, filelock, typing-extensions, zipp, importlib-metadata, virtualenv, virtualenv-clone, pbr, stevedore, virtualenvwrapper
Running setup.py install for virtualenvwrapper ... done
Successfully installed distlib-0.3.4 filelock-3.7.1 importlib-metadata-4.11.4 pbr-5.9.0 platformdirs-2.5.2 six-1.16.0 stevedore-3.5.0 typing-extensions-4.2.0 virtualenv-20.14.1 virtualenv-clone-0.5.7 virtualenvwrapper-4.8.4 zipp-3.8.0
You are using pip version 19.0.3, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.