python virtualenv cheatsheet
程序员文章站
2022-03-03 13:59:42
...
virtualenv cheatsheet
- virtualenv cannot install arbitrary python version, but can install exist python version.
install
python3 -m pip install virtualenvwrapper
make sure python3 is the default python for system
sudo update-alternatives --config python
setup path
# <<< virtualenv setup <<<
# path for python package
export WORKON_HOME=$HOME/.virtualenvs
# path for project code
export PROJECT_HOME=$HOME/git
# default python for virtual python environment
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh
# >>> virtualenv setup >>>
usage
- create environment
mkvirtualenv -a project_dir -i package_name -r requirements.txt --python /path/to/target/python
- list environment
workon
,lsvirtualenv
orshowvirtualenv
- activate environment
workon envname
- deactivate environment
deactivate
- dump environment
pip freeze > requiremnts.txt
- delete environment (deactivate first)
rmvirtualenv
推荐阅读
-
Python pandas常用函数详解
-
Python实现抢购IPhone手机
-
Python中方法链的使用方法
-
图片感兴趣区域ROI获取——鼠标选择矩阵区域+不规则多边形区域(anoconda3.4+spyder+python3.5+opencv3.4)
-
Python日常
-
python try except 捕获所有异常的实例
-
opencv_python图像处理——HOG特征描述算子-行人检测
-
使用Python实现在Windows下安装Django
-
解决pyinstaller在单一文件时无法正确添加权限清单问题,(UAC,uac_admin,manifest,asInvoker,python,requireAdministrator)
-
python基础教程:dir()和__dict__属性的区别