国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python3.6的venv模塊使用詳解

2020-02-15 22:37:15
字體:
來源:轉載
供稿:網友

今天,在在使用 pycharm 的使用,進行創建 python的時候,發現使用默認的創建的選項使用的python 3環境 。而我系統默認的python環境是 python 2.7 環境;這就引起了我的興趣。

我打開pycharm 的終端,發現:

前面 有個 venv 參數,通過 調研了一番我發現:python 的 venv 模塊可以創建一個獨立的虛擬的python運行環境,這樣就和系統的python獨立開來了。而我使用fedora 28的系統,默認安裝了python2.7 和 python3.6 兩種python環境。

我們使用 python 內置的文檔查看,venv 相關,其描述為:

Help on package venv:

NAME
venv - Virtual environment (venv) package for Python. Based on PEP 405.

我們使用python3 查看 venv 模塊的使用方法:

➜ env pwd/home/xuyaowen/Desktop/workplace/env➜ env python3 -m venv -husage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]      [--upgrade] [--without-pip] [--prompt PROMPT]      ENV_DIR [ENV_DIR ...]Creates virtual Python environments in one or more target directories.positional arguments: ENV_DIR        A directory to create the environment in.optional arguments: -h, --help      show this help message and exit --system-site-packages            Give the virtual environment access to the system            site-packages dir. --symlinks      Try to use symlinks rather than copies, when symlinks            are not the default for the platform. --copies       Try to use copies rather than symlinks, even when            symlinks are the default for the platform. --clear        Delete the contents of the environment directory if it            already exists, before environment creation. --upgrade       Upgrade the environment directory to use this version            of Python, assuming Python has been upgraded in-place. --without-pip     Skips installing or upgrading pip in the virtual            environment (pip is bootstrapped by default) --prompt PROMPT    Provides an alternative prompt prefix for this            environment.Once an environment has been created, you may wish to activate it, e.g. bysourcing an activate script in its bin directory.

通過上面的介紹,我們大致知道 venv 的模塊使用方法:

首先我們創建虛擬環境:

➜ venvtest pwd/home/xuyaowen/Desktop/workplace/venvtest➜ venvtest python3 -m venv .

我們查看創建的結果:

➜ venvtest lsbin include lib lib64 pyvenv.cfg➜ venvtest ll *lrwxrwxrwx. 1 xuyaowen xuyaowen  3 Jul 27 11:44 lib64 -> lib-rw-r--r--. 1 xuyaowen xuyaowen  69 Jul 27 11:44 pyvenv.cfgbin:total 32K-rw-r--r--. 1 xuyaowen xuyaowen 2.2K Jul 27 11:44 activate-rw-r--r--. 1 xuyaowen xuyaowen 1.3K Jul 27 11:44 activate.csh-rw-r--r--. 1 xuyaowen xuyaowen 2.4K Jul 27 11:44 activate.fish-rwxr-xr-x. 1 xuyaowen xuyaowen 271 Jul 27 11:44 easy_install-rwxr-xr-x. 1 xuyaowen xuyaowen 271 Jul 27 11:44 easy_install-3.6-rwxr-xr-x. 1 xuyaowen xuyaowen 243 Jul 27 11:44 pip-rwxr-xr-x. 1 xuyaowen xuyaowen 243 Jul 27 11:44 pip3-rwxr-xr-x. 1 xuyaowen xuyaowen 243 Jul 27 11:44 pip3.6lrwxrwxrwx. 1 xuyaowen xuyaowen  7 Jul 27 11:44 python -> python3lrwxrwxrwx. 1 xuyaowen xuyaowen  16 Jul 27 11:44 python3 -> /usr/bin/python3include:total 0lib:total 4.0Kdrwxr-xr-x. 3 xuyaowen xuyaowen 4.0K Jul 27 11:44 python3.6            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 辽宁省| 大港区| 资中县| 吴旗县| 莫力| 乡城县| 齐河县| 黔东| 兰考县| 仪征市| 旺苍县| 阳西县| 贵定县| 环江| 彭州市| 沂南县| 龙陵县| 嘉荫县| 吉木乃县| 长子县| 白水县| 封丘县| 松原市| 罗平县| 黄冈市| 乌拉特后旗| 荃湾区| 拜泉县| 连山| 濮阳县| 峡江县| 吉木乃县| 博野县| 永吉县| 河间市| 辽中县| 资中县| 肇东市| 金沙县| 静乐县| 庆元县|