(OSError: Command /opt/venv2/bin/python3 - setuptools pip wheel failed with error code 2)Linux下面创建python虚拟环境错误

创建虚拟环境命令:virtualenv --no-sit-packages --python=python3 venv1

报错:

Running virtualenv with interpreter /usr/local/python3/bin/python3
Using base prefix ‘/usr/local/python3‘
New python executable in /opt/venv2/bin/python3
Also creating executable in /opt/venv2/bin/python
Installing setuptools, pip, wheel...

  Complete output from command /opt/venv2/bin/python3 - setuptools pip wheel:
  Looking in links: /usr/local/python3/lib/python3.6/site-packages/virtualenv_support
Collecting setuptools
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ReadTimeoutError("HTTPSConnectionPool(host=‘files.pythonhosted.org‘, port=443): Read timed out. (read timeout=15)",)‘: /packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
Exception:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/urllib3/response.py", line 360, in _error_catcher
    yield
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/urllib3/response.py", line 442, in read
    data = self._fp.read(amt)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/usr/local/python3/lib/python3.6/http/client.py", line 449, in read
    n = self.readinto(b)
  File "/usr/local/python3/lib/python3.6/http/client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "/usr/local/python3/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/python3/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/python3/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/python3/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 179, in main
    status = self.run(options, args)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 315, in run
    resolver.resolve(requirement_set)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/operations/prepare.py", line 334, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 878, in unpack_url
    progress_bar=progress_bar
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 702, in unpack_http_url
    progress_bar)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 946, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 639, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/utils/hashes.py", line 62, in check_against_chunks
    for chunk in chunks:
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 607, in written_chunks
    for chunk in chunks:
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/utils/ui.py", line 159, in iter
    for x in it:
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 596, in resp_read
    decode_content=False):
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/urllib3/response.py", line 494, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/urllib3/response.py", line 459, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/local/python3/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl/pip/_vendor/urllib3/response.py", line 365, in _error_catcher
    raise ReadTimeoutError(self._pool, None, ‘Read timed out.‘)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org‘, port=443): Read timed out.
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 2567, in <module>
    main()
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 793, in main
    symlink=options.symlink,
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 1088, in create_environment
    install_wheel(to_install, py_executable, search_dirs, download=download)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 935, in install_wheel
    _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 1025, in _install_wheel_with_search_dir
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
  File "/usr/local/python3/lib/python3.6/site-packages/virtualenv.py", line 886, in call_subprocess
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command /opt/venv2/bin/python3 - setuptools pip wheel failed with error code 2

原因:可能同时在多个服务器上创建

解决:在一个服务器上创建,在执行一遍命令

virtualenv --no-sit-packages --python=python3 venv1

  

原文地址:https://www.cnblogs.com/lcy-123/p/11128176.html

时间: 2024-10-20 20:30:02

(OSError: Command /opt/venv2/bin/python3 - setuptools pip wheel failed with error code 2)Linux下面创建python虚拟环境错误的相关文章

安装 xadmin 报错: Command &quot;python setup.py egg_info&quot; failed with error code 1 in C:\Users\Python\AppData\Local\Temp\pip-install-1k1byg0p\xadmin\

报错详情 安装 xadmin 组件的时候报错 不论是命令行还是 pycharm 方式都不行 分析报错 按照报错提示是说 README.rst 文件的编码问题导致. 解决报错 通过 github 下载源码 zip 包 https://github.com/sshwsfc/xadmin 自己手动将 包里面的  README.rst 文件自行替换掉 用 txt 文本文件重命名即可 然后手动通过 本地包 安装 在安装的时候有个 兼容性需要解决. 但是 xadmin 好歹是安装上了 当前的 django

windows下使用pip安装模块发生“failed with error code 1”的解决方法

win不愧是最烂的开发平台,在安装第三方模块时经常出现些幺蛾子. 今天在window中使用python3自带的pip安装scrapy时,出错,错误代码如下: Command "f:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\WONDER~1\\AppData\\Local\\Temp\\pip-build-90gvzc6m\\Twisted\\setup.py';

解决Command &quot;python setup.py egg_info&quot; failed with error code 1坎坷路

机器:os x 本地想跑一下一个开源django博客应用,下了源码到里头pip install -r requirements.txt 结果屡次出错,Command "python setup.py egg_info" failed with error code 1 试了多次一直于最后一行这个错误. 我开始以为权限问题,setuptools问题 后来有转机了,我把 requirements.txt里头一个个安装,最后原是psycopg2这个安装有问题 pip我错怪你了,不过把官方源换

Command &quot;python setup.py egg_info&quot; failed with error code 1一种问题的解决方法

问题描述:无论是你在pycharm中直接使用import and install命令,还是pip的时候出现了Command "python setup.py egg_info" failed with error code 1这样的问题描述,需要考虑可能pip的这个源里面没有对应的python3.5的模块 解决方法:通常可以直接google "XXX for python3.5",或者在github中找到对应的python3.5的项目,将对应的.py文件添加到pyt

解决 Command &quot;python setup.py egg_info&quot; failed with error code 1 问题

参考: "pip install unroll": "python setup.py egg_info" failed with error code 1 解决 Command "python setup.py egg_info" failed with error code 1 问题 在执行 pip install -r requirements.txt 时遇到错误: Command "python setup.py egg_info

解决安装ipython时Command &quot;python setup.py egg_info&quot; failed with error code 1 in /tmp

最近使用ubuntu16.04 server版安装ipython的时候一直在报错: IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.      When using Python 2.7, please install IPython 5.x LTS Long Term Support version. python2.7 ipython Command "python setup.py egg_info"

Command &quot;python setup.py egg_info&quot; failed with error code 1 in C:\Users\w5659\AppData\Local\Temp\pip-install-t7uomu4r\xa dmin\

Error msg: C:\Users\w5659>pip install xadmin Collecting xadmin Using cached https://files.pythonhosted.org/packages/1d/e9/2ac160c532d0d462142fa90aa86a0e317295e8d86fa4caf84d04f6e24c4 9/xadmin-0.6.1.tar.gz Complete output from command python setup.py e

出现问题:Command &quot;python setup.py egg_info&quot; failed with error code 1,当进行pip3 install beautifulsoup

C:\Users\wang>pip3 install beautifulsoup Collecting beautifulsoup Using cached BeautifulSoup-3.2.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module&g

Error:Command &quot;python setup.py egg_info&quot; failed with error code 1 in /tmp/pip-build-not69mld/pysam/

使用pip命令之后报错,错误信息如下图: 提示egg_info文件错误 解决原理: 我在装载python3.6的机器上同时也安装了python2.7(软件需要),使用python 3的pip来安装python 2的git包,当然会报错. 解决代码: wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate #下载python2.7的setupt