virtualenv 可重定位——它真的有效吗 [英] virtualenv relocatable -- does it really work

查看:28
本文介绍了virtualenv 可重定位——它真的有效吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找答案,但没有找到.我有一个虚拟环境目录,一个带有 req.txt 的项目目录.当我运行 pip -r req.txt 时,它会安装一些来自 github(源)的应用程序和一些来自 pypi 的应用程序.在对虚拟 evn 进行可重定位调用后,来自 pypi 的那些很好,但是它从 github 安装的应用程序的站点包中的链接仍然指向旧目录位置.

I kept looking for answer but didn't find one. I have a virtual env dir, a project dir with a req.txt. When I run pip -r req.txt, it installs some apps from github (source) and some from pypi. The ones from pypi are fine after relocatable call on the virtual evn, however the links in the site-packages for the apps that it installed from github still point to the old directory location.

其他人见过这种行为吗?有什么快速解决方法吗?此外,可重定位不尊重最初在 virtualenv 上使用的 --no-site-packages 标志.一旦您移动虚拟并重新激活它,所有内容都可以从系统的站点包中看到.文档表明这种行为是事实,所以我想知道是否有任何快速解决方法?

Anyone else has seen this behavior? Any quick way around it? Also, relocatable is not honoring the --no-site-packages flag that was used on the virtualenv originally. Once you move the virtual and reactivate it, everything is visible from the system's site-packages. Docs indicates this behavior as a fact, so I am wondering if there is any quick way around this?

推荐答案

文档 --relocatable 是一个实验性选项,因此您遇到困难也就不足为奇了.也就是说,您是否记得在安装新软件包后重新运行 --relocatable ?如果您使用 -e 安装了来自 github 的包,这可能是一个问题,因为它不会安装到站点包中,而是安装到它的符号链接中.作为使用 --relocatable 的替代方法,您通常可以擦除特定于 virtualenv 的文件并重新创建它(我在平台之间切换时已经做​​过几次).

As stated in the documentation --relocatable is an experimental option, so it's not surprising you are having difficulties with it. That said, did you remember to re-run --relocatable after installing new packages? If you installed the packages from github with -e, that might be an issue, as it doesn't install into site-packages, but symlinks into it. As an alternative to using --relocatable, you can usually erase the virtualenv-specific files and recreate it in place (which I've done a couple times when switching between platforms).

这篇关于virtualenv 可重定位——它真的有效吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆