TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python Virtual Environments: A Primer

3 点作者 DerekBickerton超过 1 年前

1 comment

gjvc超过 1 年前
this whole notion of &quot;activating&quot; a venv really does cause more confusion and obfuscation than it solves. How?<p>Using it this way, without an &quot;activate&quot; step makes things plainer.<p><pre><code> python3.11 -m venv .venv&#x2F; .venv&#x2F;bin&#x2F;python3 -m pip install --requirement etc&#x2F;pip&#x2F;requirement.txt .venv&#x2F;bin&#x2F;python3 -m pip freeze &gt; etc&#x2F;pip&#x2F;requirement3.11.txt export PYTHONPATH=$(pwd)&#x2F;src&#x2F;python venv&#x2F;bin&#x2F;python3 -m mycorp.myapp.main </code></pre> This notation can then be used in wrapper scripts in the project. Encouraging people to experiment in the shell <i>without simultaneously and immediately making them reusable in scripts</i> may lead to a &quot;works-on-my-computer&quot; attitude.