直到今天,我已经使用virtualenv几周了,没有任何问题。使用pip使用-r requirements.txt安装我的env,它正在将错误的地方安装Django(v1.5)的一部分。而不是将整个来源放入:
env/lib/python2.7/site-packages/django/
它正在放置conf /和contrib / at的部分内容:
env/django/
当然,像管理页面这样的Django部分不起作用。当我将这两个目录移动到正确的位置时,一切正常,并且没有重复的文件。我也尝试删除整个env目录,并以相同的结果重新开始。
关于为什么virtualenv& amp; pip将django的部分拆分到错误的地方(以及如何修复它)?
答案 0 :(得分:8)
Just met the same issue in our box too. fixed it by deleting this directory
rm -rf ~/.cache/pip
path may differ by OS, check this link to find your pip cache directory https://pip.pypa.io/en/latest/reference/pip_install.html#caching
The reason is we have a corrupted cache of django in the box somehow, I found this by adding -v parameter when you install django to see the verbose output:
pip install -v django==1.5
in our case, it's just installed without downloading anything. then i added --no-cache-dir to install a clean one:
pip install -v django==1.5 --no-cache-dir
it works this time, there is no conf and contrib folder in the root of virtualenv, instead the files stay in site-packages which is we expected. and after we remove ~/.cache/pip, it also works fine with pip install django==1.5
答案 1 :(得分:1)