2017-09-06 3 views
0

Ich habe 2 pyenv VersionenWie Sie eine virtualenv erstellen Python von pyenv installiert mit

installiert
pyenv versions 
    system 
* 2.7 (set by ../.python-version) 
    3.5.3 

, wenn ich ein virtualenv in meinem Projektverzeichnis erschaffe, ich will es ein virtualenv für den aktuellen pyenv Python erstellen 2.7 Version

, aber wenn ich eine bin die Schaffung mkvirtualenv whatever

die virtuelle env unter Verwendung ist die Schaffung eines python3 virtualenv

ll ~/.virtualenvs/mobile2/bin 
total 5800 
-rw-r--r-- 1 ohadperry staff 2.0K Sep 6 10:59 activate 
-rw-r--r-- 1 ohadperry staff 1.0K Sep 6 10:59 activate.csh 
-rw-r--r-- 1 ohadperry staff 2.1K Sep 6 10:59 activate.fish 
-rw-r--r-- 1 ohadperry staff 1.1K Sep 6 10:59 activate_this.py 
-rwxr-xr-x 1 ohadperry staff 266B Sep 6 10:59 easy_install 
-rwxr-xr-x 1 ohadperry staff 266B Sep 6 10:59 easy_install-3.5 
-rwxr-xr-x 1 ohadperry staff 149B Sep 6 10:59 get_env_details 
-rwxr-xr-x 1 ohadperry staff 238B Sep 6 10:59 pip 
-rwxr-xr-x 1 ohadperry staff 238B Sep 6 10:59 pip3 
-rwxr-xr-x 1 ohadperry staff 238B Sep 6 10:59 pip3.5 
-rw-r--r-- 1 ohadperry staff 71B Sep 6 10:59 postactivate 
-rw-r--r-- 1 ohadperry staff 73B Sep 6 10:59 postdeactivate 
-rwxr-xr-x 1 ohadperry staff 68B Sep 6 10:59 preactivate 
-rw-r--r-- 1 ohadperry staff 74B Sep 6 10:59 predeactivate 
-rwxr-xr-x 1 ohadperry staff 2.8M Sep 6 10:58 python 
-rwxr-xr-x 1 ohadperry staff 2.3K Sep 6 10:59 python-config 
lrwxr-xr-x 1 ohadperry staff  6B Sep 6 10:58 python3 -> python 
lrwxr-xr-x 1 ohadperry staff  6B Sep 6 10:58 python3.5 -> python 
-rwxr-xr-x 1 ohadperry staff 245B Sep 6 10:59 wheel 
+1

Siehe diese ans, möglich Duplikat https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv – Sanket

+0

Sie richtig sind. vorschlagen, diese Frage zu schließen –

+0

Nein, schließen Sie es nicht. Diese Frage bezieht sich auf die Verwendung von virtualenv in Pyenv - der Titel sollte aktualisiert werden, um dies zu reflektieren. – danodonovan

Antwort

1

für python2.7

virtualenv -p /usr/bin/python2.7 my_env 
1

Wenn Sie pyenv verwenden sind, würde ich empfehlen, ein pyenv Gebäude gesteuert virualenv (stellen Sie sicher, pyenv-virtualenv installiert zuerst)

$ pyenv virtualenv 2.7 <your new env> 

dem Du Wechseln Sie dann zu diesem virtuellenv unter Verwendung pyenv

$ pyenv local <your new env> 

oder

$ pyenv shell <your new env> 
Verwandte Themen