如何使用pipenv为python 2.7创建虚拟环境?

时间:2019-01-06 14:29:35

标签: python-3.x python-2.7 pipenv

C:\Users\Abj>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z

C:\Users\Abj>cd Documents\VVV\qq\

C:\Users\Abj\Documents\VVV\qq>pipenv install django
Creating a virtualenv for this project…
Pipfile: C:\Users\Abj\Documents\VVV\qq\Pipfile
Using c:\python\python37-32\python.exe (3.7.2) to create virtualenv…
[    ] Creating virtual environment...Already using interpreter 
c:\python\python37-32\python.exe
Using base prefix 'c:\\python\\python37-32'
New python executable in C:\Users\Abj\.virtualenvs\qq- 
bCTw3U33\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

Successfully created virtual environment!
Virtualenv location: C:\Users\Abj\.virtualenvs\qq-bCTw3U33
Creating a Pipfile for this project…
Installing django…
Adding django to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (4f9dd2)!
Installing dependencies from Pipfile.lock (4f9dd2)…
================================ 2/2 - 00:00:01
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

C:\Users\Abj\Documents\VVV\qq>pipenv run python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z

C:\Users\Abj\Documents\VVV\qq>pipenv shell
Launching subshell in virtual environment…
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

(qq-bCTw3U33) C:\Users\Abj\Documents\VVV\qq>which python
/c/Users/Abj/.virtualenvs/qq-bCTw3U33/Scripts/python

(qq-bCTw3U33) C:\Users\Abj\Documents\VVV\qq>python -V
Python 3.7.2

我想使用python 2.7创建虚拟环境

Python 3.7.2是我的计算机环境中的默认版本。所以我在路径环境变量中将其更改为python 2.7.15。之后,在使用pipenv时,python使用python 3.7.2。

任何人都可以帮助我,在这种情况下如何使用python 2.7.15?

1 个答案:

答案 0 :(得分:0)

我从https://pypi.org/project/pipenv/得到了答案,需要使用命令

pipenv --two install django