我尝试在终端上使用以下命令安装numdifftools(ubuntu 12.04):
sudo pip install numdifftools
并默认为python3.2安装它。有没有办法强制它安装版本2.7的包
sudo python2.7 get-pip.py
/usr/lib/python2.7/dist-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /tmp/tmpByCdBF/pip.zip/pip/__init__.py, but /usr/lib/python2.7/dist-packages is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.6-py2.py3-none-any.whl#md5=4d4fb4b69df6731c7aeaadd6300bc1f2
Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.0
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
ra@ra-VGN-FZ19:~/python$ sudo pip install numdifftools
Requirement already satisfied (use --upgrade to upgrade): numdifftools in /usr/local/lib/python3.2/dist-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.4 in /usr/lib/python3/dist-packages (from numdifftools)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.8 in /usr/lib/python3/dist-packages (from numdifftools)
Cleaning up...
答案 0 :(得分:3)
也为python 2.7安装pip;
get-pip.py
。python2.7 get-pip.py
。或者通过您选择的包管理器安装它。
然后使用pip2.7
为Python 2.7安装内容。