简体   繁体   English

为什么创建环境后无法激活venv?

[英]Why can't I activate venv after creating an environment?

I am trying to use venv for my own existing project for the first time.我第一次尝试将 venv 用于我自己现有的项目。 I am not sure how to activate an environment.我不确定如何激活环境。 (This is Ubuntu) (这是Ubuntu)

$ ~/scripts/Alloy_Defender$ python3 -m venv /home/tech/scripts/Alloy_Defender

$ ~/scripts/Alloy_Defender$ venv/bin/activate
bash: venv/bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ .venv/bin/activate
bash: .venv/bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ ls
AA_start.py  auths  bin  database  functions  include  lib  lib64  
main.py  psutiltest.py  __pycache__  pyvenv.cfg  searchonetest.py  
settings  share  spamtest.py  test.py  webapi  wsgi.py

$ ~/scripts/Alloy_Defender$ /bin/activate
bash: /bin/activate: No such file or directory

$ ~/scripts/Alloy_Defender$ bin/activate
bash: bin/activate: Permission denied

$ ~/scripts/Alloy_Defender$ sudo bin/activate
[sudo] password for tech: 

sudo: bin/activate: command not found
$ ~/scripts/Alloy_Defender$ 

I used the python readthedocs.io page to find out how to do this.我使用 python readthedocs.io 页面来了解如何执行此操作。 Maybe I am interpreting it wrong?也许我解释错了? https://python.readthedocs.io/fr/latest/library/venv.html https://python.readthedocs.io/fr/latest/library/venv.html 在此处输入图像描述

It should be:它应该是:

source env_pth/bin/activate

OR要么

. env_pth/bin/activate

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

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