无法使用“setuptools pip轮失败的错误代码1”创建虚拟环境

时间:2023-01-02 04:24:26

I'm using Windows 10 with Python 3.5 64bit. And installed virtualenv from pip.

我使用的是Python 3.5 64位的Windows 10。并安装了pip的virtualenv。

When trying to create a new virtual environment, it tends to fail with the following logging:

当尝试创建一个新的虚拟环境时,它往往会以以下日志记录失败:

  > virtualenv env1

  Using base prefix 'c:\\program files\\python 3.5'
  New python executable in env1\Scripts\python.exe
  Installing setuptools, pip, wheel...
    Complete output from command E:\vp\env1\Scripts\python.exe -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
    Ignoring indexes: https://pypi.python.org/simple
  Collecting setuptools
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    The repository located at None is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host None'.
    Could not find a version that satisfies the requirement setuptools (from versions: )
  No matching distribution found for setuptools
  ----------------------------------------
  ...Installing setuptools, pip, wheel...done.
  Traceback (most recent call last):
    File "c:\program files\python 3.5\lib\runpy.py", line 170, in _run_module_as_main
      "__main__", mod_spec)
    File "c:\program files\python 3.5\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "C:\Program Files\Python 3.5\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
    File "c:\program files\python 3.5\lib\site-packages\virtualenv.py", line 832, in main
      symlink=options.symlink)
    File "c:\program files\python 3.5\lib\site-packages\virtualenv.py", line 1004, in create_environment
      install_wheel(to_install, py_executable, search_dirs)
    File "c:\program files\python 3.5\lib\site-packages\virtualenv.py", line 969, in install_wheel
      'PIP_NO_INDEX': '1'
    File "c:\program files\python 3.5\lib\site-packages\virtualenv.py", line 910, in call_subprocess
      % (cmd_desc, proc.returncode))
  OSError: Command E:\vp\env1\Scripts\python.exe -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

When execute with --no-setuptools, it works well and creates a virtual environment.

当使用-不setuptools执行时,它运行良好,并创建一个虚拟环境。

2 个解决方案

#1


0  

I had a similar but different error come up, and I had a module in my current directory that was overriding Python's string module.

我有一个相似但不同的错误出现,我在当前目录中有一个模块重写Python的字符串模块。

Here's my stack trace. Notice that it's basically saying the string module doesn't have a maketrans attribute. The docs said that was not so. This was a big hint that something was wrong with the string module, which made me check the directory for superfluous modules.

这是我的堆栈跟踪。注意,它基本上是说字符串模块没有maketrans属性。医生说事实并非如此。这是一个很大的提示,提示字符串模块有问题,这让我检查了多余模块的目录。

New python executable in ./env/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /home/.../env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 6, in <module>
  File "/usr/lib/python2.7/optparse.py", line 77, in <module>
    import textwrap
  File "/usr/lib/python2.7/textwrap.py", line 40, in <module>
    class TextWrapper:
  File "/usr/lib/python2.7/textwrap.py", line 82, in TextWrapper
    whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
AttributeError: 'module' object has no attribute 'maketrans'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/.../env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

#2


0  

I had the same error. My path of computer is 'F:\灰尘\pathon3.6'.Due to the Chinese, I got this errer. and I find your path is 'c:\program files\python 3.5' ,there is a space in 'program files'. that's why the error happened i think.The path of python I think, first must be English, second don't need any space.Hope it's helpful to you.(Don't mind my English. I'm a Chinese boy.Thanks)

我犯了同样的错误。我的电脑是“F:\灰尘\ pathon3.6 '。由于中国人,我得到了这个错误。我发现你的路径是“c:\程序文件\python 3.5”,在“程序文件”中有一个空格。这就是我认为错误发生的原因。我想python的路径,首先必须是英语,其次不需要任何空间。希望对你有帮助。(不介意我的英语。我是一个中国boy.Thanks)

#1


0  

I had a similar but different error come up, and I had a module in my current directory that was overriding Python's string module.

我有一个相似但不同的错误出现,我在当前目录中有一个模块重写Python的字符串模块。

Here's my stack trace. Notice that it's basically saying the string module doesn't have a maketrans attribute. The docs said that was not so. This was a big hint that something was wrong with the string module, which made me check the directory for superfluous modules.

这是我的堆栈跟踪。注意,它基本上是说字符串模块没有maketrans属性。医生说事实并非如此。这是一个很大的提示,提示字符串模块有问题,这让我检查了多余模块的目录。

New python executable in ./env/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /home/.../env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 6, in <module>
  File "/usr/lib/python2.7/optparse.py", line 77, in <module>
    import textwrap
  File "/usr/lib/python2.7/textwrap.py", line 40, in <module>
    class TextWrapper:
  File "/usr/lib/python2.7/textwrap.py", line 82, in TextWrapper
    whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
AttributeError: 'module' object has no attribute 'maketrans'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/.../env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

#2


0  

I had the same error. My path of computer is 'F:\灰尘\pathon3.6'.Due to the Chinese, I got this errer. and I find your path is 'c:\program files\python 3.5' ,there is a space in 'program files'. that's why the error happened i think.The path of python I think, first must be English, second don't need any space.Hope it's helpful to you.(Don't mind my English. I'm a Chinese boy.Thanks)

我犯了同样的错误。我的电脑是“F:\灰尘\ pathon3.6 '。由于中国人,我得到了这个错误。我发现你的路径是“c:\程序文件\python 3.5”,在“程序文件”中有一个空格。这就是我认为错误发生的原因。我想python的路径,首先必须是英语,其次不需要任何空间。希望对你有帮助。(不介意我的英语。我是一个中国boy.Thanks)