简体   繁体   English

virtualenv / virtualenvwrapper混乱 - 如何正确使用

[英]virtualenv/virtualenvwrapper confusion - how to properly use

Sorry if this is dumb but every piece of documentation i read doesn't ever seem to answer this question in a direct way. 对不起,如果这是愚蠢的,但我读过的每一份文件似乎都没有直接回答这个问题。 How do i properly use virtualenv so that I have a virtualenv i can call with workon? 我如何正确使用virtualenv,以便我有一个virtualenv我可以调用workon?

When i do tutorials like "Effective Django" they use the virtualenv command on an empty folder, then activate it. 当我做“Effective Django”这样的教程时,他们在空文件夹上使用virtualenv命令,然后激活它。 That works, until tomorrow when I want to work on the app again at which point the virtualenv is gone. 这是有效的,直到明天我想再次使用应用程序,此时virtualenv消失了。 What do i do at this point, I've used mkvirtualenv before and that creates a "permanent" virtualenv i can call with "workon" but I don't understand how i would use mkvirtualenv on an existing project or if this is a good idea or not, as it stands i have a project I virtualenv yesterday that has a bin folder in it and I am not sure if I need to source it again or what. 我在这一点上做了什么,我之前使用过mkvirtualenv并且创建了一个“永久性”的virtualenv,我可以用“workon”调用但是我不明白我将如何在现有项目中使用mkvirtualenv或者这是一个好的想法与否,因为它有一个项目我virtualenv昨天有一个bin文件夹,我不知道我是否需要再次采购或什么。 Ideally i want to just workon project and get to work. 理想情况下,我想只是在项目上工作并开始工作。

When i do tutorials like "Effective Django" they use the virtualenv command on an empty folder, then activate it. 当我做“Effective Django”这样的教程时,他们在空文件夹上使用virtualenv命令,然后激活它。 That works, until tomorrow when I want to work on the app again at which point the virtualenv is gone. 这是有效的,直到明天我想再次使用应用程序,此时virtualenv消失了。

I strongly doubt that this is the case, unless something is deleting your directories overnight. 我强烈怀疑是这种情况,除非一夜之间删除您的目录。 If that is the case, stop putting your code where it is being deleted. 如果是这种情况,请停止将代码放在删除的位置。

Assuming that is not the case, the solution is for you to go back to the directory you created as a virtualenv, and reactivate it. 假设情况并非如此,那么解决方案是让您返回到您作为virtualenv创建的目录,并重新激活它。

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

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