我有一个 CentOS 服务器(5.6),上面有 Python 2.4.3。我安装了另一个本地安装的 Python (2.7.5),/opt
并创建了如下软链接/usr/local/bin/python2.7
和/usr/local/python2.7
. 我想使用pip
. 使用命令安装时pip install requests
,出现以下错误:
root ~/ff_test_ff # pip install requests
Unpacking ./requests
Running setup.py egg_info for package from file:///root/ff_test_ff/requests
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/tmp/pip-MM685m-build/setup.py", line 6, in ?
import requests
File "requests/__init__.py", line 58
from . import utils
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/tmp/pip-MM685m-build/setup.py", line 6, in ?
import requests
File "requests/__init__.py", line 58
from . import utils
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /root/.pip/pip.log
我假设它仍在尝试使用 Python 2.4。我在这里检查了它说不支持2.4。那么如何运行pip install
命令但使用 python2.7 代替呢?