- Secret Recipes of the Python Ninja
- Cody Jackson
- 146字
- 2021-06-25 22:14:39
How to do it...
- The original, normal way to create a virtual environment comprises three separate steps. First, the virtual environment is created:
>>> python3 -m venv <dir_name>
- Next, the virtual environment is activated so it can be used:
>>> source <dir_name>/bin/activate
- Finally, pip is used to install the necessary module:
>>> pip install <module>
- To make this process easier, pipenv combines the pip and venv calls, so first we have to move to the desired directory where the virtual environment will be placed:
>>> cd <project_name>
- Next, we simply call pipenv to create the environment and install the desired module:
>>> pipenv install <module>
- Use pipenv to call the shell command and wait for the shell to be created. Observe that a virtual environment has been created and the command prompt is now activated within the environment. The following screenshot includes the commands from the previous steps, for clarity:
推薦閱讀
- Visual Basic .NET程序設(shè)計(jì)(第3版)
- LabVIEW 2018 虛擬儀器程序設(shè)計(jì)
- C語言程序設(shè)計(jì)(第2 版)
- Web Development with Django Cookbook
- Python Network Programming Cookbook(Second Edition)
- Instant PHP Web Scraping
- Clojure for Machine Learning
- 愛上C語言:C KISS
- Python 3 Object:oriented Programming(Second Edition)
- 超簡單:用Python讓Excel飛起來(實(shí)戰(zhàn)150例)
- 數(shù)據(jù)結(jié)構(gòu):Python語言描述
- 面向?qū)ο蟪绦蛟O(shè)計(jì)及C++(第3版)
- Oracle Database XE 11gR2 Jump Start Guide
- Java EE基礎(chǔ)實(shí)用教程
- Unity 3D UI Essentials