virtualenv 分别创建Pytho

2020-01-10 18:13:27 浏览数 (1)

完整操作如下:

代码语言:javascript复制
jhczz@vaio:~$ cd work/Python/Vietualenv/
jhczz@vaio:~/work/Python/Vietualenv$ ll
total 8
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:49 ./
drwxrwxr-x 5 jhczz jhczz 4096 Aug 28 10:41 ../
jhczz@vaio:~/work/Python/Vietualenv$ 
jhczz@vaio:~/work/Python/Vietualenv$ 
jhczz@vaio:~/work/Python/Vietualenv$ virtualenv -p /usr/bin/python2.7 ENV2.7
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/jhczz/work/Python/Vietualenv/ENV2.7/bin/python2.7
Also creating executable in /home/jhczz/work/Python/Vietualenv/ENV2.7/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
jhczz@vaio:~/work/Python/Vietualenv$ virtualenv -p /usr/bin/python3.5 ENV3.5
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/jhczz/work/Python/Vietualenv/ENV3.5/bin/python3.5
Also creating executable in /home/jhczz/work/Python/Vietualenv/ENV3.5/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
jhczz@vaio:~/work/Python/Vietualenv$ ll
total 16
drwxrwxr-x 4 jhczz jhczz 4096 Aug 28 10:50 ./
drwxrwxr-x 5 jhczz jhczz 4096 Aug 28 10:41 ../
drwxrwxr-x 7 jhczz jhczz 4096 Aug 28 10:50 ENV2.7/
drwxrwxr-x 6 jhczz jhczz 4096 Aug 28 10:50 ENV3.5/
jhczz@vaio:~/work/Python/Vietualenv$ cd ENV2.7/
jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ ll
total 40
drwxrwxr-x 7 jhczz jhczz 4096 Aug 28 10:50 ./
drwxrwxr-x 4 jhczz jhczz 4096 Aug 28 10:50 ../
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:50 bin/
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:50 include/
drwxrwxr-x 3 jhczz jhczz 4096 Aug 28 10:50 lib/
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:50 local/
-rw-rw-r-- 1 jhczz jhczz   60 Aug 28 10:50 pip-selfcheck.json
drwxrwxr-x 3 jhczz jhczz 4096 Aug 28 10:50 share/
jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ source ./bin/activate
(ENV2.7) jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ deactivate
jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ cd ../ENV3.5/
jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ 
jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ 
jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ source ./bin/activate
(ENV3.5) jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ deactivate
jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ ll
total 36
drwxrwxr-x 6 jhczz jhczz 4096 Aug 28 10:50 ./
drwxrwxr-x 4 jhczz jhczz 4096 Aug 28 10:50 ../
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:50 bin/
drwxrwxr-x 2 jhczz jhczz 4096 Aug 28 10:50 include/
drwxrwxr-x 3 jhczz jhczz 4096 Aug 28 10:50 lib/
-rw-rw-r-- 1 jhczz jhczz   60 Aug 28 10:50 pip-selfcheck.json
drwxrwxr-x 3 jhczz jhczz 4096 Aug 28 10:50 share/
jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ source ./bin/activate
(ENV3.5) jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ python
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> cd ..
  File "<stdin>", line 1
    cd ..
        ^
SyntaxError: invalid syntax
>>> 
[1]   Stopped                 python
(ENV3.5) jhczz@vaio:~/work/Python/Vietualenv/ENV3.5$ cd ../ENV2.7/
(ENV3.5) jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ source ./bin/activate
(ENV2.7) jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
[2]   Stopped                 python
(ENV2.7) jhczz@vaio:~/work/Python/Vietualenv/ENV2.7$ 

0 人点赞