在virtualenv中python pip错误'无法获取索引基本URL'

时间:2017-11-24 08:48:30

标签: python-2.7 pip virtualenv ubuntu-12.04

可以直接使用pip install -r requirements.txt,但是,当我尝试在 virtualenv 中使用它时,它会因这些错误而失败:

test@te:~$ cd flaskbb/
test@te:~/flaskbb$ 
test@te:~/flaskbb$ source .venv/bin/activate
(.venv)test@te:~/flaskbb$ pip install -r requirements.txt 
Obtaining file:///home/test/flaskbb (from -r requirements.txt (line 50))
  Running setup.py egg_info for package from file:///home/test/flaskbb

    no previously-included directories found matching 'flaskbb/themes/*/node_modules'
    no previously-included directories found matching 'flaskbb/themes/*/.sass-cache'
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.py[co]' found anywhere in distribution
Downloading/unpacking alembic==0.9.1 (from -r requirements.txt (line 1))
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement alembic==0.9.1 (from -r requirements.txt (line 1))
No distributions at all found for alembic==0.9.1 (from -r requirements.txt (line 1))
Storing complete log in /home/test/.pip/pip.log
(.venv)test@te:~/flaskbb$

这是我的系统:

test@te:~$ uname -ar
Linux te 3.2.0-101-generic #141-Ubuntu SMP Thu Mar 10 21:43:24 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
test@te:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
test@te:~$ uname -r
3.2.0-101-generic

寻求帮助!!!

1 个答案:

答案 0 :(得分:6)

您可以指定https网址: sudo pip install -r requirements.txt -i https://pypi.python.org/simple