运行时pip install django-cron
出现以下错误:
ERROR: Error [Errno 13] Permission denied: '/vagrant/.venv/bin/python' while executing command python setup.py egg_info
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/vagrant/.venv/bin/python'
Consider using the `--user` option or check the permissions.
但是,如果我使用--user
,我会收到一个不同的错误消息:
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
我的venv已激活。
当我之前尝试安装库时,一切正常,如果我使用 sudo 命令,我会收到以下警告:
WARNING: The directory '/home/vagrant/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
遗憾的是,使用-H
并不能解决问题,我不确定如何更改对 .venv 文件的访问权限,我们将不胜感激。
我只收到 Python 模块django-cron
和的此错误,但可以成功安装django-crontab
其他模块。pillow
编辑4:我的设置有点笨拙,因为我使用的是Vagrant,但我有PyCharm Community Editon,所以我最终下载了两次包,一次只是为了让编辑器识别它,另一次是我运行程序的Vagrant ,当我在 PyCharm 中执行此操作时,它在 PyCharm 中工作。
这是Vagrantfile
我使用的:
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get install python3-distutils -y
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
rm get-pip.py
sudo pip install virtualenv
cd /vagrant
virtualenv -p /usr/bin/python3 .venv --always-copy
echo "cd /vagrant && source /vagrant/.venv/bin/activate" >> /home/vagrant/.profile
SHELL
end