不同操作系统中的 VirtualEnv [英] VirtualEnv in different operating systems

查看:52
本文介绍了不同操作系统中的 VirtualEnv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事数据分析方面的学校项目.我们使用 OS X、Ubuntu 和 Windows,所以我们想知道如何在所有平台上使用相同的代码.我们创建了一个虚拟环境并安装了所有需要的外部库,当我们将文件夹更改为另一个操作系统时,我们运行:

I'm currently working on a school project in data analytics. We use OS X, Ubuntu and Windows, so we would like to know how to use the same code in all platforms. We created an virtual environment and installed all the external libraries needed, and when we change the folder to another operating system we run:

virtualenv path/to/virtualenvFolder --alwayscopy --download

但是,即使使用 sudo,大多数库都不起作用,或者出现诸如 权限被拒绝..." 之类的错误.有没有什么好的方法可以在一个文件夹中为多个操作系统传递 Python 代码和外部库?

But most of the libraries do not work, or have errors like "permission denied...", even with sudo. Is there any good way of passing Python code and external libraries in a folder for several operating systems?

推荐答案

您在此处并未真正提供太多信息.但听起来您将 virtualenv 及其已安装的库包含在您在系统之间共享的代码中.你不应该那样做.

You haven't really given much information here. But it sounds like you are including your virtualenv and its installed libraries in the code you share between systems. You shouldn't do that.

只分享项目代码;每个用户都应该直接安装他们自己的依赖项副本.您应该在项目中包含一个 requirements.txt 列出所有这些,每个开发人员都可以在自己的 virtualenv 中运行 pip install -r requirements.txt.

Only share the project code; each user should install their own copies of the dependencies directly. You should include a requirements.txt in the project which lists all these, and each developer can run pip install -r requirements.txt inside their own virtualenv.

这篇关于不同操作系统中的 VirtualEnv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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