[英]What is the purpose of pyvenv.cfg after the creation of a Python virtual environment?
When I create a virtual environment in Python on Windows cmd, in the virtual environment folder, the following files appear:当我在 Windows cmd 上的 Python 中创建虚拟环境时,在虚拟环境文件夹中,出现以下文件:
What is the goal of pyvenv.cfg creation? pyvenv.cfg 创建的目标是什么? Can I use it in any way?
我可以以任何方式使用它吗?
pyvenv.cfg
is a configuration file that stores information about the virtual environment such as pyvenv.cfg
是一个配置文件,其中存储了有关虚拟环境的信息,例如
If print content of pyvenv.cfg
如果打印
pyvenv.cfg
的内容
$ cat myenv/pyvenv.cfg
home = /usr/bin
include-system-site-packages = false
version = 3.8.5
This is a sample output of the pyvenv.cfg
file.这是
pyvenv.cfg
文件的示例输出。
Cheers!干杯!
One of the problems though is that the "version=" information lies.但问题之一是“版本=”信息存在。 For example, in a recent.venv I created for a project it says:
例如,在我为一个项目创建的 recent.venv 中,它说:
home = /Library/Frameworks/Python.framework/Versions/3.10/bin
include-system-site-packages = false
version = 3.10.4
however, when I just installed python 3.10.6, it updates the base 3.10, and now the version info is incorrect.但是,当我刚安装 python 3.10.6 时,它更新了基础 3.10,现在版本信息不正确。 As I am just doing tutorials, I am happy that the environment now has the latest version, but I don't see the point of having incorrect version information in the cfg file.
由于我只是在做教程,我很高兴环境现在拥有最新版本,但我看不出 cfg 文件中的版本信息不正确的意义。
In looking at the venv/bin folder I see symlinks of python, python3, and python3.10 commands.在查看 venv/bin 文件夹时,我看到了 python、python3 和 python3.10 命令的符号链接。
It appears that by default on my system the venv is using symlinks instead of copies of the python binaries, which is fine, but if using symlinks, the cfg should not list the subversion number.看来,默认情况下,在我的系统上,venv 使用符号链接而不是 python 二进制文件的副本,这很好,但如果使用符号链接,cfg 不应列出颠覆号。 We can specify that the venv command create copies instead, but my problem is with the incorrect info on the.cfg file.
我们可以指定 venv 命令创建副本,但我的问题是 .cfg 文件上的信息不正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.