Created
September 19, 2019 09:09
-
-
Save lize240810/f98350bef577de52645685fc0781f19a to your computer and use it in GitHub Desktop.
最近升级使用了一下Ubuntu18.04才刚使用,Ubuntu中推荐使用虚拟环境来操作python 下面是一份虚拟环境配置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 开发Python | |
| ### 虚拟环境配置教程 | |
| - 使用虚拟环境是比不可少的,特奉上一个配置虚拟环境的教程 | |
| - 记得需要先安装`aptpthon3-pip` | |
| - 两个虚拟必备库 | |
| ``` | |
| pip3 install virtualenv | |
| pip3 install virtualenvwrapper | |
| ``` | |
| - 查看安装目录(为环境变量准备) | |
| ``` | |
| type virtualenvwrapper.sh | |
| ``` | |
| - 创建目录(为方便配置,建议在home目录下创建) | |
| ``` | |
| mkdir ~/.virtualenvs | |
| ``` | |
| - 配置环境变量 | |
| - 打开配置文件 | |
| ``` | |
| vim ~/.bashrc | |
| ``` | |
| - 添加配置(末尾添加) | |
| ``` | |
| export WORKON_HOME=~/.virtualenvs(你创建的virtualenvs目录路径) | |
| source /usr/local/bin/virtualenvwrapper.sh(你的virtualenvwrapper安装目录) | |
| ``` | |
| - 刷新环境变量 | |
| ``` | |
| source ~/.bashrc | |
| ``` | |
| - 创建虚拟环境 | |
| ``` | |
| mkvirtualenv python3 -p /usr/bin/python3.6(指定Python的版本) | |
| ``` | |
| - 进入环境变量 | |
| ``` | |
| workon python 3 | |
| ``` | |
| - 退出环境变量 | |
| ``` | |
| deactivate | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment