P.hunter
P.hunter

Reputation: 1365

Python: Setting up virtualenv and project for 2.7

I have python 2.7 and 3.5 on my machine , and i can switch between them according to my projects however when i try to setup virtualenv for a project in which i need python 2.7 it says

Using base prefix 'c:\\users\\user\\appdata\\local\\programs\\python\\python35-32'

and furthermore when i try to start a scrapy project in the virtualenv i just created it gives

New Scrapy project 'new', using template directory

'c:\\users\\user\\appdata\\local\\programs\\python\\python35-32\\lib\\site-packages\\scrapy\\templates\\project'

but i want it for 2.7 how can i achieve this , any help?

Upvotes: 1

Views: 1843

Answers (2)

williezh
williezh

Reputation: 1015

I have python2.7, 3.5 and 3.6 on my machine, and I created a scrapy project with 2.7 by this way:

virtualenv --python=python2.7 .env
source .env/bin/activate
pip install scrapy
python -m scrapy startproject aspider

Upvotes: 4

Ouss
Ouss

Reputation: 3875

use the -p argument with the path to the python executable to use. For example, on linux:

$ virtualenv -p /usr/bin/python2.7 /home/ouss/myproject/venv

on windows, maybe: $ virtualenv -p c:\Python27\python.exe c:\myproject\venv

Upvotes: 2

Related Questions