Windows 上的 Python 3 中的 pyvenv 脚本在哪里安装? [英] Where is pyvenv script in Python 3 on Windows installed?

查看:16
本文介绍了Windows 上的 Python 3 中的 pyvenv 脚本在哪里安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读 PEP 的以下声明后405

After reading the following statement from PEP 405

还提供了一个 pyvenv 安装脚本,使这更方便:

A pyvenv installed script is also provided to make this more convenient:

pyvenv/path/to/new/virtual/environment

我尝试创建一个新的虚拟环境,但惨遭失败;

I tried to create a new virtual environment and failed miserably;

C:\>python --version
Python 3.3.1
C:\>pyvenv myvenv
'pyvenv' is not recognized as an internal or external command,
operable program or batch file.

显然 pyvenv 脚本没有安装到 Scripts 文件夹中,该文件夹通常被添加到 PATH 环境变量中,从而可以轻松运行这样的命令行中的脚本.

Apparently pyvenv script is not installed into Scripts folder which is being usually added to the PATH environment variable making it possible to easily run such scripts on the command line.

PEP 405 是否错误,是在 Python 3.3 中没有正确实现还是我遗漏了什么?

Is PEP 405 wrong, was it not properly implemented in Python 3.3 or am I missing something?

推荐答案

看起来 pyvenv 脚本放在 Python 安装文件夹内的 Tools\Scripts 子文件夹中(sys.prefix).似乎将它复制到 Scripts 子文件夹是一个好主意,因为它允许简单地从命令行键入 pyvenv(假设 Scripts 文件夹已经在 PATH 上).由于此脚本没有 exe 包装器,因此必须确保

It looks like pyvenv script is placed in Tools\Scripts subfolder inside Python installation folder (sys.prefix). It seems like copying it to Scripts subfolder is a good idea as it allows to simply type pyvenv from the command line (assuming Scripts folder is already on the PATH). As there's no exe wrapper for this script one has to make sure

  • .py 扩展名被添加到 PATHEXT 环境变量中,以便键入脚本时,Windows 找到放置在 PATH 上的 Python 脚本在命令提示符下输入名称.
  • .py 扩展名与 Python 可执行文件或 Python 启动器 (py.exe) 相关联,从 Python 3.3 开始可用
  • .py extension is added to PATHEXT environment variable so that Windows finds Python script placed on the PATH when typing script's name at the command prompt.
  • .py extension is associated either with Python executable or with Python launcher (py.exe) which is available starting from Python 3.3

或者,您可以只输入 python -m venv 而不是 pyvenv 并省去所有麻烦...

Alternatively one can just type python -m venv instead of pyvenv and save himself all of the hassle...

相关的 Python 错误 17480 - pyvenv 应该安装在 Windows 上更明显的地方

Related Python bug 17480 - pyvenv should be installed someplace more obvious on Windows

这篇关于Windows 上的 Python 3 中的 pyvenv 脚本在哪里安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆