【问题标题】:Problems installing virtualenvwrapper in OSX 10.11.3在 OSX 10.11.3 中安装 virtualenvwrapper 时出现问题
【发布时间】:2016-06-02 02:40:06
【问题描述】:

我是编程和 python 的新手,但已经学习了几个月。我的目标是为 Python3.5.1 安装 openCV3。为此,我一直在关注本教程:http://www.pyimagesearch.com/2015/06/29/install-opencv-3-0-and-python-3-4-on-osx/

我的问题是我似乎无法正确安装 virtualenvwrapper。当我重新加载我的 .bash_profile 时,终端告诉我“bash:/usr/local/bin/virtualenvwrapper.sh:没有这样的文件或目录”。

在安装阶段,终端返回如下:

Gwenns-New-MBP:~ gwennlaine$ pip3 install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in ./Library/Python/2.7/lib/python/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in ./Library/Python/2.7/lib/python/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /Library/Python/2.7/site-packages (from stevedore->virtualenvwrapper)
Collecting six>=1.9.0 (from stevedore->virtualenvwrapper)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 725, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 752, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 266, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/kd/k4jl6x895ydcsk0mcx1pnvp40000gn/T/pip-A3qhrB-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

我应该注意我已经尝试了许多不同的这种/替代方法来安装它,并且已经在谷歌上花了两天时间研究这个问题,但似乎没有任何效果!

对我做错了什么有什么想法吗?

提前致谢!

格温

【问题讨论】:

    标签: python macos bash opencv virtualenvwrapper


    【解决方案1】:

    所以,我厌倦了尝试实现这一目标,所以我选择了另一条路线。我安装了pyenv。然后我安装了 pyenv-virtualenv 和 pyenv-virtualenvwrappers 作为插件。这使我能够创建一个稳定且隔离的虚拟环境来安装和编译 OPenCV3。与普通的 virtualenv 相比,有些命令有所不同,但总体而言,它实现了相同的目标!

    【讨论】:

      【解决方案2】:

      看起来您正在尝试通过 python 3 安装 virtualenvwrapper,但 osx 使用的是 python 2.7。你有没有安装python3?

      【讨论】:

      • 在命令行中执行which pip3,看看是否得到正确版本的pip3
      • 它返回“/usr/local/bin/pip3”。不应该这么说吗?
      • 在命令中输入这个以查看文件是否确实存在。 ls /usr/local/bin/virtual*.您还必须升级 python 2.7 而不是使用 mac 附带的。你也从自制软件安装了 python 2.7 吗?
      • 它返回:“/usr/local/bin/virtualenv /usr/local/bin/virtualenv-clone /usr/local/bin/virtualenv-3.5” Python 2.7 是自带的El Capitan... 3.5.1 版本是使用 Home brew 安装的。我不认为 virtualenv 会造成问题:它实际上是 virtualenvwrapper,它似乎没有安装在任何地方......
      • 是的,但是从上面的错误中它说它已经满足了要求,但是从 2.7 开始。这意味着出于某种原因 pip3 指向 Python 2.7。
      猜你喜欢
      • 2018-01-20
      • 1970-01-01
      • 2019-02-16
      • 2020-07-08
      • 1970-01-01
      • 1970-01-01
      • 2016-05-21
      • 2014-03-15
      • 2018-01-26
      相关资源
      最近更新 更多