无法在 Google Drive 文件夹中创建虚拟环境 [英] Can't create a virtual environment in the Google Drive folder

查看:69
本文介绍了无法在 Google Drive 文件夹中创建虚拟环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Google Drive 来保存我的代码项目的副本,以防我的计算机死机(我也在使用 GitHub,但不是在一些私人项目上).

I'm using Google Drive to keep a copy of my code projects in case my computer dies (I'm also using GitHub, but not on some private projects).

但是,当我尝试使用 virtualenv 创建虚拟环境时,出现以下错误:

However, when I try to create a virtual environment using virtualenv, I get the following error:

PS C:\users\fchatter\google drive> virtualenv env
New python executable in C:\users\fchatter\google drive\env\Scripts\python.exe
ERROR: The executable "C:\users\fchatter\google drive\env\Scripts\python.exe" could not be run: [Error 5] Access is denied

我尝试过的事情:

  • 我认为这是因为 venv 的路径包含空格,但该命令在其他带有空格的路径中有效.我还尝试按照 virtualenv 文档中的建议安装 win32api 库,但没有成功.

  • I thought it was because the path to the venv included blank spaces, but the command works in other paths with blank spaces. I also tried installing the win32api library, as recommended in the virtualenv docs, but it didn't work.

以管理员身份运行 PowerShell.

running the PowerShell as an administrator.

关于如何解决这个问题的任何想法?我目前的解决方法是在 Google 云端硬盘之外创建 venv,这可行但不方便.

Any ideas on how to solve this? My workaround at the moment is to create the venv outside of the Google Drive, which works but is inconvenient.

推荐答案

不要在云同步文件夹中设置虚拟环境,也不应该从这样的文件夹运行 python 脚本.这是个坏主意.它们不适用于版本控制.对该文件夹的写访问(修改文件)是有限的,因为在您的情况下,Google 驱动器会定期同步该文件夹,这几乎总是会阻止对该文件夹的独占写访问.

Don't set up a virtual env in a cloud synced folder, nor should you run a python script from such a folder. It's a bad idea. They are not meant for version control. Write access (modifying files) to the folder is limited because in your case Google drive will periodically sync the folder which will prevent exclusive write access to the folder almost always.

TLDR;文件同步时不可能修改文件.

TLDR; One cant possibly modify files while they are being synced.

我建议你坚持使用 git 进行版本控制.

I suggest you stick to git for version control.

这篇关于无法在 Google Drive 文件夹中创建虚拟环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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