错误:无法创建'/usr/local/lib/python2.7/dist-packages/virtualenv_support':权限被拒绝

 溜溜的情歌哆瑞咪 发布于 2023-02-03 11:32

我正在使用ubuntu 12.04而我正在尝试使用安装virtualenv,但突然间我遇到了这个错误.

samuel@sampc:~$ pip install virtualenv
Downloading/unpacking virtualenv
  Running setup.py egg_info for package virtualenv

    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
  Running setup.py install for virtualenv
    error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/samuel/build/virtualenv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Z2v_fR-record/install-record.txt:
    running install

running build

running build_py

running install_lib

creating /usr/local/lib/python2.7/dist-packages/virtualenv_support

error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/samuel/build/virtualenv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Z2v_fR-record/install-record.txt failed with error code 1
Storing complete log in /home/samuel/.pip/pip.log

有没有人对我的案子有所了解?

3 个回答
  • 我听说使用sudopip是不安全的.

    尝试添加--user到您的命令的最后,提到这里.

    pip install packageName --user
    

    我怀疑使用此方法安装意味着其他用户无法使用这些包.

    2023-02-03 11:34 回答
  • 使用

    sudo pip install virtualenv
    

    显然,在行之前添加"sudo"时,您将具有管理员权限...只是不要忘记您的密码.

    2023-02-03 11:36 回答
  • 您没有Python文件夹的权限.

    sudo chown -R $USER /usr/local/lib/python2.7
    

    2023-02-03 11:36 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有