1
#virtualenv的位置
C:\Users\Administrator>pip install virtualenv
Requirement already satisfied: virtualenv in c:\programdata\anaconda3\lib\site-packages
2
#Django的位置
C:\Users\Administrator>pip install -i https://pypi.douban.com/simple/ django
Requirement already satisfied: django in c:\programdata\anaconda3\lib\site-packages
Requirement already satisfied: pytz in c:\programdata\anaconda3\lib\site-packages (from django)
3
#創(chuàng)建一個scrapytest的虛擬環(huán)境
C:\Users\Administrator>virtualenv scrapytest
4
#虛擬環(huán)境在Windows的路徑
C:\Users\Administrator\scrapytest
5
#cd到這幾個文件拴曲,執(zhí)行 activate.bat語句塞茅,創(chuàng)建虛擬環(huán)境成功
C:\Users\Administrator\scrapytest\Scripts>activate.bat
6
#退出虛擬環(huán)境的語句 deactivate.bat
(scrapytest) C:\Users\Administrator\scrapytest\Scripts>deactivate.bat
7
#加入選擇Python2.7的版本,后面再把路徑粘貼過來就可以了
C:\Users\Administrator\scrapytest\Scripts>virtualenv -p
#我本機(jī)的例子C:\Users\Administrator\scrapytest\Scripts>virtualenv -p C:\Python27\python.exe scrapypy2
8
#cd到文件中,創(chuàng)建scrapyppy2文件
C:\Users\Administrator\scrapytest\Scripts\scrapypy2\Scripts>activate.bat
(scrapypy2) C:\Users\Administrator\scrapytest\Scripts\scrapypy2\Scripts>
#然后我們就可以用Python2的虛擬環(huán)境了
9
#安裝virtualenvwrapper 就不用再折騰文件路徑的問題了
C:\Users\Administrator\scrapytest\Scripts\scrapypy2\Scripts>pip install virtualenvwrapper-win
#我們可以使用workon的命令查看有哪些虛擬環(huán)境了
10
#上面的步驟都搞好了志珍,使用mkvirtualenv py2scrapy就可以直接創(chuàng)建一個py2scrapy的虛擬環(huán)境了只嚣,不信自己workon查看一下
C:\Users\Administrator\scrapytest\Scripts\scrapypy2\Scripts>mkvirtualenv py2scrapy
11