繁体   English   中英

setuptools pip 轮失败,错误代码为 2

[英]setuptools pip wheel failed with error code 2

我正在阅读 Google Cloud Platform 的Python Bookshelf 应用教程,我正在启动我的 virtualenv的步骤,但我卡住了。

运行virtualenv -p python3 env产生此错误:

⇒  virtualenv -p python3 env
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/puoygae/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/bin/python3
Also creating executable in /Users/puoygae/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/bin/python
Please make sure you remove any previous custom paths from your /Users/puoygae/.pydistutils.cfg file.
Installing setuptools, pip, wheel...
  Complete output from command /Users/puoygae/Lab/ga...data/env/bin/python3 - setuptools pip wheel:
  Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/75/b3/0a106dfaf7f48aef638da80b32608617cc8de4b24a22c8cd3759c32e5d30/setuptools-41.1.0-py2.py3-none-any.whl
Collecting pip
  Using cached https://files.pythonhosted.org/packages/8d/07/f7d7ced2f97ca3098c16565efbe6b15fafcba53e8d9bdb431e09140514b0/pip-19.2.2-py2.py3-none-any.whl
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: setuptools, pip, wheel
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_set.py", line 731, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_install.py", line 841, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_install.py", line 1040, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/wheel.py", line 343, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/wheel.py", line 321, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/Users/puoygae/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/lib/python3.6/site-packages/easy_install.py'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 2327, in <module>
    main()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/puoygae/Lab/ga...data/env/bin/python3 - setuptools pip wheel failed with error code 2

我按照本指南来设置我的 python 开发环境。 我在互联网上搜索了解决方案,但我没有运气通过这一步。

是什么导致了这个问题,我该如何解决?

编辑:使用 sudo 运行它会产生以下错误:

⇒  sudo virtualenv -p python3 env
Password:
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/myUserName/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/bin/python3
Not overwriting existing python script /Users/myUserName/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/bin/python (you must use /Users/myUserName/Lab/gae-bookshelf-app-python-flexible-experiment/getting-started-python/2-structured-data/env/bin/python3)
Please make sure you remove any previous custom paths from your /Users/myUserName/.pydistutils.cfg file.
Installing setuptools, pip, wheel...
  Complete output from command /Users/myUserName/Lab/ga...data/env/bin/python3 - setuptools pip wheel:
  The directory '/Users/myUserName/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/myUserName/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/75/b3/0a106dfaf7f48aef638da80b32608617cc8de4b24a22c8cd3759c32e5d30/setuptools-41.1.0-py2.py3-none-any.whl (576kB)
Collecting pip
  Downloading https://files.pythonhosted.org/packages/8d/07/f7d7ced2f97ca3098c16565efbe6b15fafcba53e8d9bdb431e09140514b0/pip-19.2.2-py2.py3-none-any.whl (1.4MB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: setuptools, pip, wheel
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_set.py", line 731, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_install.py", line 841, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/req/req_install.py", line 1040, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/wheel.py", line 476, in move_wheel_files
    generated.extend(maker.make(spec))
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 353, in make
    self._make_script(entry, filenames, options=options)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 257, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 231, in _write_script
    self._fileop.write_binary_file(outname, script_bytes)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/distlib/util.py", line 388, in write_binary_file
    with open(path, 'wb') as f:
PermissionError: [Errno 1] Operation not permitted: '/bin/easy_install'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 2327, in <module>
    main()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/myUserName/Lab/ga...data/env/bin/python3 - setuptools pip wheel failed with error code 2

我也有这个问题。

我的 pip 正在查看不同的存储库,我使用 AWS 的 CodeArtifact 创建的存储库,它需要登录和凭据。 就我而言,我需要做的就是删除这个文件~/.config/pip/pip.config

@puoygae 通过在他的 MacOS 上创建一个新的用户帐户并单独安装 python 来解决他的问题。 他的管理员帐户中的环境令人费解。

对此已知问题的其他修复可以是:

  • 删除 /usr/local/lib/python2.7/dist-packages/ 中的所有 virtualenv* 内容并根据此GitHub 问题重新安装它。
  • 从 pip 卸载任何安装工具和轮子。 也从apt-get remove wheel setuptools virutalenv卸载它们(如果它们存在,在某些情况下,wheel 和 setuptools 都可以存在,并且可能会从 pip 和 apt-get 安装中相互冲突)> 从这里下载新的 setuptools-35.0.2和 virutalenv-15.1.0 从这里开始 全新安装这两个工具。
  • 按照 此处更新 openSSL 的说明进行操作,然后尝试使用 pip install 设置虚拟环境。
  • 可以尝试打开系统终端并输入 pip install virtualenv。 重新启动IDE。
  • 尝试安装 pysocks - sudo pip install pysocks 使用 - 取消设置 all_proxy 重试
  • 您也可以尝试升级到 platformio-ide 2.1.5
  • “setenv all_proxy https://proxy_here:port_here/”。 不仅解决了此设置的代理问题,还解决了所有安装的代理问题。
  • 另请查看针对同一问题的此stackoverflow 线程修复程序。

参考链接:

https://github.com/platformio/platformio-atom-ide/issues/1245 https://github.com/pypa/virtualenv/issues/876

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM