我尝试在 Ubuntu 机器的虚拟环境中使用 pip
部署 Python 包,但遇到了与权限相关的问题。例如:
(TestVirtualEnv)test@testServer:~$ pip install markdown2
终止于:
错误:无法创建“/home/test/virtualenvs/TestVirtualEnv/lib/python3.3/site-packages/markdown2.py”:权限被拒绝
我不能 sudo
,因为它将全局安装包,而不是在虚拟环境中。我 chown
编辑 site-packages
; ls
shows only directories related to easy_install
, pip
and setuptools
, and nothing related to Markdown.
如何使用 pip
在虚拟环境中部署包,而不会遇到与权限相关的错误?
原文由 Arseni Mourzenko 发布,翻译遵循 CC BY-SA 4.0 许可协议
virtualenv
permission problems might occur when you create thevirtualenv
assudo
and then operate withoutsudo
in thevirtualenv
.正如您在问题评论中发现的那样,这里的解决方案是 创建
virtualenv
没有sudo
能够在没有sudo
的情况下 工作(特别是写) .