7

Python虚拟环境Virtualenv使用详解 | CHEGVA

 2 years ago
source link: https://chegva.com/5675.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Python虚拟环境(2)—Virtualenv使用详解

◎知识点

  1. 安装Virtualenv

  2. 使用Virtualenv

  3. 使用Virtualenv时的项目交接

  4. 在PyCharm中使用Virtualenv

1.安装Virtualenv

Python虚拟环境(2)—Virtualenv使用详解
~/anzhihe $ pip3 install virtualenv
~/anzhihe $ virtualenv --version
virtualenv 20.21.0 from /Users/buhaihui/opt/anaconda3/lib/python3.9/site-packages/virtualenv/__init__.py

2.使用Virtualenv

2.1 创建虚拟环境

Python虚拟环境(2)—Virtualenv使用详解
~/Desktop $ mkdir MyProject1                                                                                    
~/Desktop $ cd MyProject1
~/Desktop/MyProject1 $ virtualenv MyVirEnv
created virtual environment CPython3.9.7.final.0-64 in 903ms
  creator CPython3Posix(dest=/Users/anzhihe/Desktop/MyProject1/MyVirEnv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/anzhihe/Library/Application Support/virtualenv)
    added seed packages: pip==23.0.1, setuptools==67.4.0, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

~/Desktop/MyProject1 $ where python
/Users/anzhihe/opt/anaconda3/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python

# 查看MyVirEnv里的安装内容
~/Desktop/MyProject1/MyVirEnv $ tree -N -L 4
.
├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── activate.nu
│   ├── activate.ps1
│   ├── activate_this.py
│   ├── pip
│   ├── pip-3.9
│   ├── pip3
│   ├── pip3.9
│   ├── python -> /Users/anzhihe/opt/anaconda3/bin/python
│   ├── python3 -> python
│   ├── python3.9 -> python
│   ├── wheel
│   ├── wheel-3.9
│   ├── wheel3
│   └── wheel3.9
├── lib
│   └── python3.9
│       └── site-packages
│           ├── _distutils_hack
│           ├── _virtualenv.pth
│           ├── _virtualenv.py
│           ├── distutils-precedence.pth
│           ├── pip
│           ├── pip-23.0.1.dist-info
│           ├── pip-23.0.1.virtualenv
│           ├── pkg_resources
│           ├── setuptools
│           ├── setuptools-67.4.0.dist-info
│           ├── setuptools-67.4.0.virtualenv
│           ├── wheel
│           ├── wheel-0.38.4.dist-info
│           └── wheel-0.38.4.virtualenv
└── pyvenv.cfg
安志合个人博客,版权所有 丨 如未注明,均为原创 丨 转载请注明转自:https://chegva.com/5675.html | ☆★★每天进步一点点,加油!★★☆ | 

</div


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK