如何在没有requirements.txt文件的情况下复制venv环境?

huangapple go评论44阅读模式
英文:

how can I duplicate venv environment without requirements.txt?

问题

我想复制我的环境。由于个人原因,我不能使用conda或其他工具。我也不想使用requirements.txt,因为它太花时间。

我该如何解决这个问题?

我只是复制并粘贴了原始环境文件夹:myvenv1 到 myvenv2

但如果我激活myvenv2,它会显示myvenv1的名称,就像这样。

root: > source ./myvenv2/bin/activate

(myvenv1) root: >

英文:

I want to duplicate my environment. I cannot use conda or other tools in personal reason. I also don't want to use requirements.txt because it takes too long time.

How can I solve this problem?

I just copied and pasted original environment folder: myvenv1 to myvenv2

But if I activate myvenv2, it shows myvenv1's name, like this.

root: > source ./myvenv2/bin/activate

(myvenv1) root: >

答案1

得分: 0

使用requirements.txt可能是最快且最安全的解决方案。

否则,我不100%确定,但是...如果你复制了一个虚拟环境,我认为你需要编辑一些文件的内容。例如,activate脚本将负责设置提示符。但请注意,虚拟环境不是设计用于复制、重命名或移动的。如果不小心操作,会导致问题。

英文:

Using requirements.txt is probably the fastest and safest solution.

Otherwise, I am not 100% sure but... if you copy a virtual environment, then I think that you need to edit the content of some files. For example the activate script which will be in charge of setting the prompt. But note that virtual environments are not designed to be copied, renamed or moved around. Things will break if you are not careful.

huangapple
  • 本文由 发表于 2023年1月9日 14:14:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75053735.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定