简体   繁体   中英

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:

  • Currently using Ubuntu 16.04
  • I created a virtualenv and downloaded Django and postgreSQL within the virtual environment.
  • I also downloaded and am using Python 3.5.2 within the virtual environment.

My entire folder structure is on GitHub so that I can edit the code on the go (Again, everything working fine on Ubuntu).

The problem comes when I want to start doing some editing on Windows 10 using Powershell. 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.

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.

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. You will have to firstly create a new virtual environment on Windows because they have differences on OS variations. So navigate to the directory where you would like to create the new virtual environment on Windows and run the following command:- 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

As now the activate.bat file is in Scripts you can activate your virtualenv by the following command: Scripts\\activate

After the environment is activated you can pip install -r requirements.txt and then run your manage.py script as usual.

For further reference you can read:- https://virtualenv.pypa.io/en/stable/userguide/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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