[英]Using Windows to run a virtual environment Created on Ubuntu
so i have been developing a website with a backend database. 所以我一直在开发一个带有后端数据库的网站。 The following is my current setup and it is working great: 以下是我当前的设置,并且运行良好:
My entire folder structure is on GitHub so that I can edit the code on the go (Again, everything working fine on Ubuntu). 我的整个文件夹结构都在GitHub上,因此我可以随时随地编辑代码(再次,在Ubuntu上一切正常。)
The problem comes when I want to start doing some editing on Windows 10 using Powershell. 当我想开始使用Powershell在Windows 10上进行一些编辑时,就会出现问题。 I am unsure of how to run the 'activate.sh', 'activate.csh', or 'activate.fish' file in order to run the virtual environment and initialize my server using 'python manage.py runserver' so I can start editing my website. 我不确定如何运行“ activate.sh”,“ activate.csh”或“ activate.fish”文件以运行虚拟环境并使用“ python manage.py runserver”初始化服务器,因此我可以启动编辑我的网站。
Has anyone run into the problem and found out how to fix this? 有没有人遇到这个问题,并找到解决方法? Any help on how to get started working on Windows would be great. 任何有关如何开始在Windows上工作的帮助都将非常有用。
If you need any more details id be glad to provide them. 如果您需要更多详细信息,很高兴为您提供。
Thanks! 谢谢!
Assuming that you have created a virtualenv on ubuntu without relocatable option. 假设您在ubuntu上创建了virtualenv且没有可重定位选项。 You will have to firstly create a new virtual environment on Windows because they have differences on OS variations. 首先,您必须在Windows上创建一个新的虚拟环境,因为它们在操作系统版本上存在差异。 So navigate to the directory where you would like to create the new virtual environment on Windows and run the following command:- virtualenv . 因此,导航到要在Windows上创建新虚拟环境的目录,然后运行以下命令:-virtualenv。 (Note the . specifies current directory option) After this there will be three directories created in your directory namely 1) Include 2) Lib 3) Scripts (注意。指定当前目录选项)之后,将在您的目录中创建三个目录,即1)包括2)库3)脚本
As now the activate.bat file is in Scripts you can activate your virtualenv by the following command: Scripts\\activate 现在,activate.bat文件位于脚本中,您可以通过以下命令激活virtualenv:Scripts \\ activate
After the environment is activated you can pip install -r requirements.txt and then run your manage.py script as usual. 激活环境后,您可以pip install -r requirements.txt,然后照常运行您的manage.py脚本。
For further reference you can read:- https://virtualenv.pypa.io/en/stable/userguide/ 有关更多参考,您可以阅读: -https : //virtualenv.pypa.io/en/stable/userguide/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.