【问题标题】:Can I use other python implementation via virtualenv/virtualenvwrapper?我可以通过 virtualenv/virtualenvwrapper 使用其他 python 实现吗?
【发布时间】:2017-12-01 15:13:15
【问题描述】:

经过一段时间的搜索(也许这还不够,但我认为我在这方面没有取得进展),我无法在 virtualenv/virtualenvwrapper 中找到有关其他 Python 实现的兼容性的信息。 “其他实现”是指 PyPy、IronPython、Cython、Jython...

例如,我可以使用以下代码为不同的 python 版本创建一个 virtualenv。

mkvirtualenv -p /usr/bin/python2.6 new_venv

但是当我尝试为 PyPy 创建一个 virtualenv 时:

mkvirtualenv -p /usr/bin/pypy new_venv

系统抛出一些错误。

编辑: 我正在使用 virtualenvwrapper-win。它抛出

Running virtualenv with interpreter C:\pypy2-v5.8.0-win32\pypy.exe
New pypy executable in C:\Users\fangming.zfm\Envs\test-123\bin\pypy.exe
Installing setuptools, pip, wheel...done.
system cannot find the path specified.
system cannot find the path specified.
system cannot find the path specified.

为什么我们不能这样做?是因为缺乏兴趣,还是技术上不可行?

【问题讨论】:

  • 错误是什么?
  • 你是否在虚拟环境之外安装了 pypy 的 setuptools、pip 和 wheel 包?
  • @phd,我根据我看到的here 使用pypy -m ensurepip 安装了pip,但它似乎仍然没有解决我的“系统找不到指定的路径”问题。
  • 试试pypy -m pip install -U setuptools pip wheel
  • @phd,仍然是同样的错误,现在我想知道是否可以更深入地研究该错误消息。

标签: python python-2.7 virtualenv pypy virtualenvwrapper


【解决方案1】:

为我工作:

$ mktmpenv -p pypy
Running virtualenv with interpreter /usr/bin/pypy
New pypy executable in /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/pypy
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/preactivate
virtualenvwrapper.user_scripts creating /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/postactivate
virtualenvwrapper.user_scripts creating /home/phd/.virtualenvs/tmp-b29122e40f353f03/bin/get_env_details
This is a temporary environment. It will be deleted when you run 'deactivate'

$ python --version
Python 2.7.8 (2.4.0+dfsg-3, Dec 20 2014, 13:30:11)
[PyPy 2.4.0 with GCC 4.9.2]

你的错误到底是什么?

【讨论】:

    【解决方案2】:

    问题是由于pypy.exe 位于/bin/ 目录下,而不是Scripts 目录下(如 virtualenvwrapper-win 预期的那样)。

    它有一个问题 (https://github.com/davidmarble/virtualenvwrapper-win/issues/30),应该比较容易解决。

    【讨论】:

      猜你喜欢
      • 2015-09-02
      • 2016-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多