程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

ERROR: Command errored out with exit status 1: command: /bin/python -c ‘import sys, setuptools, toke

編輯:Python

pip install virtualenvwrapper在Collecting virtualenv-clone時報錯

  • 報錯內容如下
    • 解決方式

報錯內容如下

[[email protected] 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 …,把包安裝到指定用戶下,並使當前操作用戶可去執行使用。
安裝成功則如下:

[[email protected] 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.

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved