0

我正在尝试设置环境以在新笔记本电脑上执行一些 Python。我brew install python3先做了,然后去确保我安装了 pip pip --version。终端说我没有,所以我做了brew install pip

然后我去安装 pipenv pip install 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 install --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'")]
4

1 回答 1

1

你已经安装了 Python 版本 3,但是 pip 属于 Python 版本 2。首先,卸载你已经安装的 pip。现在您应该安装 pip3,例如使用brew install pip3. 但是,pip3 应该已经与 Python 3 一起安装,所以首先要确保 pip3 确实没有安装。

于 2018-03-26T22:35:47.403 回答