当前位置:网站首页>Virtualenv+pipenv virtual environment management
Virtualenv+pipenv virtual environment management
2022-07-01 12:04:00 【chuntian_ tester】
Virtual environment is mainly to create mutually independent operating environment for different projects ; In a virtual environment , Each project has its own dependency package , And isolated from other projects ; The same package can have different versions in different virtual environments , And there is no limit to the number of virtual environments , We can use tools virtualenv perhaps pipenv To create a virtual environment .
virtualenva Installation and use -windows
1. install virtualenv
pip install virtualenv
2. Install the virtual environment management pack virtualenv
pip install virtualenvwrapper(win-->virtualenvwrapper-win)
3. Create a directory to hold the virtual environment ( Name it .env or .virtualenv)
4. Configure environment variables ( Variable name :WORKON_HOME, value : The directory path of the virtual environment created above )
MAC:
1. install virtualenv
$ sudo pip install virtualenv
2. Install the virtual environment management pack Virtaulenvwrapper yes virtualenv The expansion pack, , It's easier to add , Delete , Copy , Switch virtual environment . Run the following command to install successfully , Default installed in /usr/local/bin
below :
$ sudo easy_install virtualenvwrapper
3. see virtualenv Version of
virtualenv --version.
4. Create virtual environment Directory , And enter
$ mkdir ~/workspaces $ cd ~/workspaces
5. Next, create a folder , Used to store all virtual environments :
$ mkdir ~/workspaces $ cd ~/workspaces
6. Set the environment variable : $ export WORKON_HOME=~/workspaces
$ source /usr/local/bin/virtualenvwrapper.sh
7. Creating a virtual environment
$ mkvirtualenv env1 $ mkvirtualenv env2
8. List all virtual environments :
$ workon
9. Switch to a virtual environment :
$ workon env1
10. Exit virtual environment :
$ deactivate
11. Delete virtual environment :
$ rmvirtualenv env2
12. After switching to a virtual environment , Reuse pip Install in the current environment
$ workon env1 $ pip install numpy
Be careful , Every time before entering the virtual environment , Environment variables should be configured first :
$ cd ~/workspaces $ export WORKON_HOME=~/workspaces $ source /usr/local/bin/virtualenvwrapper.sh $ workon env1
After starting the virtual environment ,pycharm Configure project interpreter, Find the corresponding virtual environment python file , such as :
~/workspaces/env1/bin/python2.7
边栏推荐
猜你喜欢
Technology sharing | MySQL: how about copying half a transaction from the database?
迅为i.MX8Mmini开发板离线构建Yocto系统
使用set_handler过滤掉特定的SystemC Wraning &Error Message
Dlhsoft Kanban, Kanban component of WPF
ABBIRB120工业机器人机械零点位置
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
MQ-防止消息丢失及重复消费
Neo4j Chinese developer monthly - issue 202206
2022/6/29学习总结
深入理解 grpc part1
随机推荐
Redis configuration environment variables
I'm in Zhongshan. Where is a better place to open an account? Is it actually safe to open an account online?
redis配置环境变量
Use set_ Handler filters out specific SystemC wrapping & error messages
Botu V15 add GSD file
CAD如何设置标注小数位
指纹浏览器工作原理、使用场景以及重要性简单讲解
91.(cesium篇)cesium火箭發射模擬
力扣首页简介动画
Consolidate -c operator
C # dependency injection (straight to the point) will be explained as soon as you see the series
Value/sortedset in redis
Computer graduation project asp Net attendance management system vs developing SQLSERVER database web structure c programming computer web page source code project
91. (cesium chapter) cesium rocket launch simulation
Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
Learning summary on June 30, 2022
Technology sharing | MySQL: how about copying half a transaction from the database?
Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
Golang introduces the implementation method of the corresponding configuration file according to the parameters