我正在使用ubuntu 12.04,我正在尝试pip安装虚拟环境,但突然我收到了这个错误。
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
有人知道我的案子吗?
我听说将sudo
与pip
一起使用是不安全的。
尝试将--user
添加到命令的末尾,如此处所述。
pip install packageName --user
我怀疑使用此方法安装意味着其他用户无法使用这些包。
您没有Python文件夹的权限。
sudo chown -R $USER /usr/local/lib/python2.7
使用
sudo pip install virtualenv
显然,在行前添加“sudo”时,您将拥有管理员的权力…只是不要忘记您的密码。