简体   繁体   English

使用系统python的Python venv?

[英]Python venv using system python?

Why does python -m venv py38 use the system python still??为什么python -m venv py38仍然使用系统python??

在此处输入图片说明

This just burned my pretty severely, I had a very customized python 3.8 environment that I thought was isolated from the system as advertised by venv , my system python just upgraded to 3.9 and now I have to re-build everything.这只是严重烧伤了我,我有一个非常定制的 python 3.8 环境,我认为它与venv宣传的系统隔离,我的系统 python 刚刚升级到 3.9,现在我必须重新构建所有内容。

Any suggestions on a way to create actually isolated python environments would be appreciated.任何有关创建实际隔离的 python 环境的方法的建议将不胜感激。

https://docs.python.org/3/library/venv.html https://docs.python.org/3/library/venv.html

Running this command creates the target directory (creating any parent directories that don't exist already) and places a pyvenv.cfg file in it with a home key pointing to the Python installation from which the command was run (a common name for the target directory is .venv).运行此命令会创建目标目录(创建任何尚不存在的父目录)并在其中放置一个 pyvenv.cfg 文件,其中包含一个指向运行该命令的 Python 安装的 home 键(目标的通用名称)目录是 .venv)。 It also creates a bin (or Scripts on Windows) subdirectory containing a copy/symlink of the Python binary/binaries (as appropriate for the platform or arguments used at environment creation time).它还创建一个 bin(或 Windows 上的脚本)子目录,其中包含 Python 二进制文件/二进制文件的副本/符号链接(适用于平台或环境创建时使用的参数)。

This makes me think that it's possible to have not a copy of the python installation but a link to it.这让我认为可能没有 python 安装的副本,而是有一个链接。

Anyway pyenv.cfg should have the path of your python, I suggest to change it.无论如何 pyenv.cfg 应该有你的python的路径,我建议改变它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM