Python 无法安装pipenv,无法升级pip';s安装工具

Python 无法安装pipenv,无法升级pip';s安装工具,python,python-3.x,python-2.7,pip,pipenv,Python,Python 3.x,Python 2.7,Pip,Pipenv,我正在尝试设置环境,以便在新笔记本电脑上运行Python。我先安装了python3brew,然后确保我已经用pip--version安装了pip。终端说我没有,所以我安装了pip 然后我用pip安装pipenv安装了pipenv。我收到了以下错误消息: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip

我正在尝试设置环境,以便在新笔记本电脑上运行Python。我先安装了python3
brew,然后确保我已经用
pip--version
安装了pip。终端说我没有,所以我安装了pip

然后我用
pip安装pipenv
安装了pipenv。我收到了以下错误消息:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-build-o6M3Ve/pipenv/.
搜索时,我看到有人说pip的安装工具需要更新为
pip安装--upgrade setuptools
。当我尝试这样做时,我得到了一个很长的错误,我将在下面发布。这件事让我不知所措,不知道从哪里开始。非常感谢您的帮助

例外情况:

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.3-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
错误:

[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/var/folders/9t/pk6bmgc968d_fys24blkrgc40000gn/T/pip-Rp7V_U-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

您已经安装了Python版本3,但是pip属于Python版本2。首先,卸载已安装的pip。现在您应该安装pip3,例如使用
brew安装pip3
。但是,pip3应该与Python 3一起安装,因此首先确保尚未安装pip3。

通过brew安装python3后,应使用
pip3
或软链接到
pip
,(无需通过brew安装
pip
)可以参考我在这里的另一个答案:@CSJ我需要摆脱
pip
?是的,删除它,就像下面提到的答案一样