简体   繁体   English

venv中没有激活

[英]No activate in venv

There is no activate script in my virtual environment's bin folder.我的虚拟环境的 bin 文件夹中没有激活脚本。 Only files are: python, python3, python3.9.只有文件是:python、python3、python3.9。

How to fix my environment without deleting it?如何修复我的环境而不删除它? I'm using venv not virtualenv.我使用的是 venv 而不是 virtualenv。 I'm using Linux.我正在使用 Linux。

My problem is similar to this one - There is no activate when I am trying to run my virtual env我的问题与此类似 - 当我尝试运行我的虚拟环境时没有激活

One of answers says I should run.一个答案说我应该跑。

python3.7 -m venv venv python3.7 -m venv venv

But I don't understand this syntax.但我不明白这种语法。 Should I literally write python3.9 -m venv venv into my terminal?我应该从字面上将 python3.9 -m venv venv 写入我的终端吗? Will it fix my enviroment?它会修复我的环境吗?

Also I want to say that newly created environments work as expected and all the others too.另外我想说的是,新创建的环境和所有其他环境都按预期工作。

i think this is helpfull for you我认为这对你有帮助

but for basic use it like this:但对于基本使用它是这样的:

python3.7 -m venv myenvname
source myenvname/bin/activate

and if activate isnt there try to find that in sub directories如果激活不存在尝试在子目录中找到它

I had this problem with python 3.10, I had to install venv for my version otherwise I was missing the activate script.我在使用 python 3.10 时遇到了这个问题,我必须为我的版本安装 venv,否则我会丢失激活脚本。 (I am using the deadsnake ppa on ubuntu) after this the activate script appears when creating new venv. (我在 ubuntu 上使用 deadsnake ppa)之后,在创建新的 venv 时会出现激活脚本。

sudo apt-get install python3.9-venv

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

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