[英]How to associate django project with virtualenv
I'm working with pycharm 3 pro on windows. 我正在Windows上使用pycharm 3 pro。 I'm trying to set up a virtualenv to develop django in.
我正在尝试建立一个virtualenv来开发Django。
I have my virualenv in /f/development3/tools/virtualenvs/. 我在/ f / development3 / tools / virtualenvs /中有我的virualenv。 Its called "renv".
其称为“ renv”。 I have a project in /f/PycharmProjects/ called "r1".
我在/ f / PycharmProjects /中有一个名为“ r1”的项目。
In pycharm I have set the interpreter to r1 to be the virtualenv "renv". 在pycharm中,我已将解释器设置为r1,成为virtualenv“ renv”。 However when I open a terminal and do:
但是,当我打开终端并执行以下操作时:
/f/PycharmProjects/r1 $ which pip
/f/Python27/Scripts/pip
So it seems that the project is not assosciated with the virtualenv through pycharm. 因此,似乎该项目没有通过pycharm与virtualenv关联。 Rather than try to figure out how to do this in pycharm ( I've posted a question in their forum ) I would like to put my django project "into" the virtualenv using the command line ( or cutting/pasting ).
与其尝试在pycharm中弄清楚该如何做(我已经在他们的论坛中发布了一个问题),我想使用命令行(或剪切/粘贴)将django项目“放入” virtualenv中。 How do I do this?
我该怎么做呢?
Well you would need to associate your project with the virtualenv
assuming that have created a virtualenv
in the first place. 好吧,您需要将您的项目与
virtualenv
相关联, virtualenv
是首先创建了virtualenv
。 Then you would need to use virtualenvwrapper
and then use the workon
command. 然后,您需要使用
virtualenvwrapper
,然后使用workon
命令。 This is actually more involved than you'd initially expect. 实际上,这比您最初预期的要复杂得多。
I could give you a long explanation regarding this, but there is already an excellent tutorial regarding this. 我可以为您提供详细的解释,但是已经有一个很好的教程。
virtualenv
and virtualenvwrapper
virtualenv
和virtualenvwrapper
Please note that virtualenvwrapper
is *nix specific, so for windows you would need to find an alternate solution. 请注意,
virtualenvwrapper
是特定于* nix的,因此对于Windows,您需要找到替代解决方案。 Luckily such a solution exists, and its for powershell . 幸运的是,存在这样的解决方案, 并且它适用于powershell 。
Actually, there is a port of virtualenvwrapper for Windows, called virtualenvwrapper-win . 其实, 有 virtualenvwrapper for Windows的端口,称为virtualenvwrapper双赢 。 It works specifically on the Windows command line (not powershell).
它专门在Windows命令行(不是powershell)上工作。 You may, of course, prefer to work in powershell, but be aware of what your options are.
当然,您可能更喜欢在Powershell中工作,但请注意您的选择。 The only drawback is that you need to do your git adds/commits, etc. in a separate git bash shell.
唯一的缺点是您需要在单独的git bash shell中进行git add / commit等操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.