首页 > 解决方案 > 在虚拟框中的 Ubuntu 18.04 中的共享目录中创建虚拟环境失败

问题描述

我试图在我的 Ubuntu 18.04 虚拟机中安装烧瓶,以实现发送电子邮件的 API。我遵循本教程: https://runnable.com/docker/python/dockerize-your-flask-application 尝试设置虚拟环境时,使用以下两个命令出现此错误:

-python3 -m venv venv
错误:

Error: [Errno 30] Read-only file system: 'lib' -> '/shared/BerryCert/Agent/Flask_Web/venv/lib64' 

-Virtualenv venv
错误:

File "/usr/lib/python3.6/shutil.py", line 365, in copytree
    raise Error(errors)
shutil.Error: [('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', '/shared/BerryCert/Agent/Flask_Web/venv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', "[Errno 30] Read-only file system: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/shared/BerryCert/Agent/Flask_Web/venv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so'"), ('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', '/shared/BerryCert/Agent/Flask_Web/venv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', "[Errno 30] Read-only file system: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/shared/BerryCert/Agent/Flask_Web/venv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so'")] 

你能向我解释一下这个问题吗?

标签: pythonvirtualenv

解决方案


创建时virtualenv,传递--always-copy标志。

所以像:virtualenv --always-copy [your-environment]

这应该复制环境文件 - 而不是对它们进行符号链接。virtualbox 上的符号链接有时会出现问题。希望这可以帮助!


推荐阅读