简体   繁体   English

激活虚拟环境不起作用

[英]activating virtual environment not working

On my server (digitalocean droplet), when I activate my virtual environment, it seems something is not working.在我的服务器(digitalocean droplet)上,当我激活我的虚拟环境时,似乎有些东西不起作用。 I say the because:我说因为:

  1. It does not give me the virtual environment name inside paranthesis on the command line它没有给我命令行括号内的虚拟环境名称
  2. When I run deactivate commend, it says deactivate: command not found当我运行deactivate推荐时,它显示deactivate: command not found
user@django-s-1vcpu-2gb-sfo3-01:~/example$source env/bin/activate
user@django-s-1vcpu-2gb-sfo3-01:~/example$

running source env/bin/activate should output the following command line:运行source env/bin/activate应该输出以下命令行:

(user) user@django-s-1vcpu-2gb-sfo3-01:~/example$

I did check which folder I am at and if the env virtual environment is shown under that folder.我确实检查了我所在的文件夹以及 env 虚拟环境是否显示在该文件夹下。 I also looked at this point , and when I go to python manage.py shell and type those lines of code, it says I am not in the virtualenv!我也查看了这一点,当我转到python manage.py shell并键入这些代码行时,它说我不在 virtualenv 中! So, why is that?那么,这是为什么呢? and how to fix it without completely mess up my live production site?以及如何在不完全搞乱我的现场制作网站的情况下修复它?

I just recreated the virtual environment using virtualenv env .我刚刚使用virtualenv env重新创建了虚拟环境。 I was reluctant to do so fearing making more problems with my live production site, but it looks OK so far.我不愿意这样做,因为担心我的现场制作网站会出现更多问题,但到目前为止看起来还不错。 I will update if this solution has unintended consequences down the road.如果此解决方案在未来产生意想不到的后果,我将进行更新。

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

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