简体   繁体   English

无法安装到虚拟环境

[英]Cannot Install into Virtual Environment

I have a virtual environment I have created on an Ubuntu virtal machine I am hosting on a windows PC. 我有一个虚拟环境,该环境是在Windows PC上托管的Ubuntu虚拟机上创建的。 I intend to replicate my virtual machine in my virtal environment on the virtual machine. 我打算在虚拟机上的虚拟环境中复制虚拟机。 However, when trying to install modules to the VE I get a messgae saying that they are already installed - they're not installed in the VE but are on the VM. 但是,当尝试将模块安装到VE时,我得到一个消息,说它们已经安装了-它们没有安装在VE中,但是在VM上。 I thought when set active the VE would have no context of the VM which hosts it? 我以为,当设置为活动状态时,VE将没有托管它的VM的上下文吗?

I have downloaded virtualenvironment sudo pip install virtualenv and then created a virtual environment sudo virtualenv virtual_environment . 我已经下载了virtualenvironment sudo pip install virtualenv ,然后创建了一个虚拟环境sudo virtualenv virtual_environment I then set the virtual environment to active source virtual_environment/bin/activate 然后,我将虚拟环境设置为活动source virtual_environment/bin/activate

When I try and do an apt-get install I get the message 0 upgraded, 0 newly installed, 0 to remove and 202 not upgraded despite the fact I have no modules whatsoever on the VE. 尝试执行apt-get安装时,尽管我在VE上没有任何模块,但消息0升级,0新安装,0删除且202未升级。

What am I doing wrong? 我究竟做错了什么?

Thanks! 谢谢!

I think you're getting a bit confused about what virtualenv does. 我想您对virtualenv的功能有些困惑。 It is only for isolating Python files and libraries (those you install with pip install ). 它仅用于隔离Python文件和库(使用pip install文件和库)。 It does nothing for your operating system files (those you install with apt-get ). 它对您的操作系统文件(使用apt-get安装的文件)不起作用。

If you want to create a re-usable container of operating system files (with apt-get ) then look instead at something like Docker. 如果您想创建一个可重用的操作系统文件容器(使用apt-get ),请查看Docker之类的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM