<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Python on Net Boy</title>
    <link>https://lian.st/categories/python/</link>
    <description>Recent content in Python on Net Boy</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <lastBuildDate>Tue, 22 Oct 2024 16:15:19 +0800</lastBuildDate><atom:link href="https://lian.st/categories/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Python 配置虚拟环境</title>
      <link>https://lian.st/posts/a51a736c/</link>
      <pubDate>Tue, 22 Oct 2024 16:15:19 +0800</pubDate>
      
      <guid>https://lian.st/posts/a51a736c/</guid>
      
      <description>&lt;h2 id=&#34;环境&#34;&gt;环境&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;OS Version： Linux Mint 22&lt;/li&gt;
&lt;li&gt;Python Versinon： 3.12.3&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;安装virtualenv&#34;&gt;安装virtualenv&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pip install virtualenv
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;创建virtualenv&#34;&gt;创建virtualenv&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;virtualenv [虚拟环境名称]
#如果不想使用系统的包,加上–no-site-packeages参数
virtualenv  --no-site-packages 创建路径名
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;激活virtualenv&#34;&gt;激活virtualenv&lt;/h2&gt;
&lt;h3 id=&#34;linux&#34;&gt;Linux&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd venv
source ./bin/activate
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;windows&#34;&gt;Windows&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; cd venv
&amp;gt; .\Scripts\activate.bat
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;退出virtualenv&#34;&gt;退出virtualenv&lt;/h2&gt;
&lt;h3 id=&#34;linux-1&#34;&gt;Linux&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ deactivate
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;windows-1&#34;&gt;Windows&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; .\Scripts\deactivate.bat
&lt;/code&gt;&lt;/pre&gt;</description>
      
    </item>
    
  </channel>
</rss>
