<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with xvm]]></title><description><![CDATA[A list of topics that have been tagged with xvm]]></description><link>http://forum.d2learn.org/tags/xvm</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 14:08:15 GMT</lastBuildDate><atom:link href="http://forum.d2learn.org/tags/xvm.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[xlings: xvm: 多版本管理工具中工作空间式环境隔离的三种模式 - 全局、本地&#x2F;local、自定义]]></title><description><![CDATA[<h2>多版本切换及工作空间命令演示</h2>
<p dir="auto">利用工作空间机制, 支持自动版本切换(以node为例)</p>
<pre><code class="language-bash">speak@speak-pc:~/test/xvm$ node --version
v22.12.0
speak@speak-pc:~/test/xvm$ xvm list node # 查看所有版本
23.6.0
22.12.0

speak@speak-pc:~/test/xvm$ xvm use node 23.6.0 # 切换到23.6.0
using -&gt; target: node, version: 23.6.0
speak@speak-pc:~/test/xvm$ node --version # 验证版本
v23.6.0
speak@speak-pc:~/test/xvm$ xvm current node # 显示版本信息(xvm下有个test工作空间配置)

	&lsqb;&lsqb;test + global&rsqb;&rsqb;

node:	23.6.0
nodejs:	23.6.0	 --&gt;  [node]

all targets added

speak@speak-pc:~/test/xvm$ cd .. # 返回上级目录(自动切换到全局空间)
speak@speak-pc:~/test$ node --version # node版本已经变成了22
v22.12.0
speak@speak-pc:~/test$ xvm current node # 查看当前版本情况

	&lsqb;&lsqb;global&rsqb;&rsqb;

node:	22.12.0
nodejs:	23.6.0	 --&gt;  [node]

all targets added

speak@speak-pc:~/test$ cd xvm # 再次进入xvm目录(node会自动变成test工作空间的版本
speak@speak-pc:~/test/xvm$ node --version
v23.6.0
speak@speak-pc:~/test/xvm$ 

</code></pre>
<h2>三种使用模式</h2>
<p dir="auto"><strong>1-全局模式</strong></p>
<ul>
<li>全局工作空间</li>
<li>支持使用注册/移除不同版本</li>
<li>支持版本切换/及别名设置</li>
<li>支持一键关闭或开启xvm对宿主系统的影响</li>
</ul>
<p dir="auto"><strong>2-local模式</strong></p>
<ul>
<li>基于目录的工作空间</li>
<li>工作空间继承控制(不继承及和全局版本进行隔离)</li>
<li>工作空间激活状态控制</li>
<li>工作空间配置可以编辑(一般用于项目控制版本)</li>
<li>记录使用版本并导出工作空间配置文件</li>
</ul>
<p dir="auto"><strong>3-自定义工作空间 - (计划开发中)</strong></p>
<ul>
<li>自定义工作空间且目录无关 (一般用于特定版本配置组合记录)</li>
<li>其他功能类似local</li>
</ul>
<h2>开源地址</h2>
<ul>
<li><a href="https://github.com/d2learn/xlings/tree/main/core/xvm" rel="nofollow ugc">https://github.com/d2learn/xlings/tree/main/core/xvm</a></li>
</ul>
]]></description><link>http://forum.d2learn.org/topic/63/xlings-xvm-多版本管理工具中工作空间式环境隔离的三种模式-全局-本地-local-自定义</link><guid isPermaLink="true">http://forum.d2learn.org/topic/63/xlings-xvm-多版本管理工具中工作空间式环境隔离的三种模式-全局-本地-local-自定义</guid><dc:creator><![CDATA[sunrisepeak]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[xlings: 新增加XVM版本管理子模块&#x2F;工具 - Rust编写的支持基于目录的工作空间环境隔离]]></title><description><![CDATA[<h1>XVM | Xlings Version Manager - <a href="https://github.com/d2learn/xlings/tree/main/core/xvm" rel="nofollow ugc">Github</a></h1>
<p dir="auto">一个简单且通用的版本管理工具 - 支持多版本管理、支持工作空间和环境隔离、支持多版本的命令别名</p>
<p dir="auto"><img src="/assets/uploads/files/1736259066707-ab7d9843-fa0b-4463-80d9-263392561345-image.png" alt="ab7d9843-fa0b-4463-80d9-263392561345-image.png" class=" img-fluid img-markdown" /></p>
<hr />
<h2>下载安装</h2>
<p dir="auto"><strong>使用xim进行安装</strong></p>
<pre><code class="language-bash">xim --update index
xim -i xvm # 或 xlings install xvm
</code></pre>
<p dir="auto"><strong>直接下载</strong></p>
<blockquote>
<p dir="auto">直接下载压缩包&amp;解压出可执行程序</p>
</blockquote>
<p dir="auto"><a href="https://github.com/d2learn/xlings/releases/tag/xvm-dev" rel="nofollow ugc">release地址</a></p>
<p dir="auto">注: 使用时需要把xvm程序放到一个已经加入PATH的目录里</p>
<h2>基本用法</h2>
<p dir="auto"><strong>xvm add | 添加程序</strong></p>
<blockquote>
<p dir="auto">支持添加不同版本, 也支持创建命令别名</p>
</blockquote>
<pre><code class="language-bash"># xvm add [target] [version] --path [bin-path] --alias [command/bin-file]
xvm add python 2.7.18 --path python2_dir --alias python2
xvm add python 3.12.3 --path python3_dir --alias python3.12
xvm add pv 0.0.1 --alias "python --version"
</code></pre>
<ul>
<li><code>target</code>: 生效时可以使用的命令</li>
<li><code>version</code>: 这个是标识target的版本号, 建议和应用版本保持一致。如果是别名可以自定义</li>
<li><code>--path</code>: 程序所在的实际路径(可选)</li>
<li><code>--alias</code>: 在"所设置的路径"下实际执行的命令(可选), 默认为target</li>
</ul>
<blockquote>
<p dir="auto">注: 默认第一次添加的版本作为全局工作空间的默认版本</p>
</blockquote>
<p dir="auto"><strong>xvm list | 查询程序的所有版本</strong></p>
<blockquote>
<p dir="auto">支持模糊查询</p>
</blockquote>
<pre><code class="language-bash"># xvm list [target]
xvm list python
xvm list p
</code></pre>
<p dir="auto"><strong>xvm use | 切换版本</strong></p>
<blockquote>
<p dir="auto">可以切换到对应的版本, 版本号支持模糊匹配</p>
</blockquote>
<pre><code class="language-bash"># xvm use [target] [version]
xvm use python 3.12.3
xvm use python 2   # -&gt; 2.7.18
</code></pre>
<p dir="auto"><strong>xvm current | 查询当前版本</strong></p>
<blockquote>
<p dir="auto">支持模糊匹配</p>
</blockquote>
<pre><code class="language-bash"># xvm current [target]
xvm current p
</code></pre>
<p dir="auto"><strong>xvm remove | 移除之前被添加的程序</strong></p>
<blockquote>
<p dir="auto">这里的移除只是从xvm的版本数据库中删除记录</p>
</blockquote>
<pre><code class="language-bash"># xvm remove [target] [version]
xvm remove pv 0.0.1
</code></pre>
<h2>工作空间和环境隔离</h2>
<blockquote>
<p dir="auto">目前xvm支持基于目录的工作空间, 可以和全局工作空间进行隔离(默认有一个全局工作空间)</p>
</blockquote>
<h3>基础命令</h3>
<p dir="auto"><strong>创建工作空间</strong></p>
<pre><code class="language-bash"># xvm workspace [target]
xvm workspace test
</code></pre>
<blockquote>
<p dir="auto">注: 工作空间, 默认时激活和继承全局工作空间版本情况的</p>
</blockquote>
<p dir="auto"><strong>设置当前工作空间激活状态</strong></p>
<blockquote>
<p dir="auto">当工作空间未激活时就会使用默认的全局空间, 激活时会覆盖全局空间</p>
</blockquote>
<pre><code class="language-bash"># xvm workspace [target]
xvm workspace test --active false
xvm workspace test --active true
</code></pre>
<p dir="auto"><strong>设置当前工作空间是否继承全局空间</strong></p>
<pre><code class="language-bash"># xvm workspace [target]
xvm workspace test --inherit false
xvm workspace test --inherit true
</code></pre>
<h3>使用场景</h3>
<blockquote>
<p dir="auto">在指定目录创建工作空间, 使用特定的版本</p>
</blockquote>
<pre><code class="language-bash"># 假设全局空间中python使用的版本是3
xvm workspace test # 创建工作空间
xvm use python 2   # 切换python版本
xvm current python # 查询当前版本
python --version   # 验证 - python2
cd ..
python --version   # 返回上级目录/版本会自动切换到全局版本python3
</code></pre>
<h2>其他</h2>
<p dir="auto"><strong>临时关闭xvm版本管理功能</strong></p>
<blockquote>
<p dir="auto">通过设置全局workspace的状态, 可以控制xvm的版本管理是否生效</p>
</blockquote>
<pre><code class="language-bash">xvm workspace global --active false
xvm workspace global --active true
</code></pre>
]]></description><link>http://forum.d2learn.org/topic/62/xlings-新增加xvm版本管理子模块-工具-rust编写的支持基于目录的工作空间环境隔离</link><guid isPermaLink="true">http://forum.d2learn.org/topic/62/xlings-新增加xvm版本管理子模块-工具-rust编写的支持基于目录的工作空间环境隔离</guid><dc:creator><![CDATA[sunrisepeak]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>