pip install到本地文件夹

时间:2012-10-09 20:33:23

标签: installation python-2.7 pip

是否可以将软件包安装到任意文件夹?例如我尝试将软件包安装到本地文件夹,但是它会抛出错误,任何其他软件包都会出现同样的错误

/tmp$  pip install --install-option="--prefix=mypython" IPy
Downloading/unpacking IPy
  Downloading IPy-0.75.tar.gz
  Running setup.py egg_info for package IPy

Installing collected packages: IPy
  Running setup.py install for IPy

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
    requirement.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/req.py", line 604, in install
    f = open(os.path.join(egg_info_dir, 'installed-files.txt'), 'w')
IOError: [Errno 2] No such file or directory: 'mypython/lib/python2.7/site-packages/IPy-0.75-py2.7.egg-info/installed-files.txt'

同样this question表明它应该有效,所以这里有什么问题?

1 个答案:

答案 0 :(得分:10)

--prefix=需要成为一条绝对的道路。这样做的:

$ pip install --install-option="--prefix=/tmp/mypython" IPy
例如,

应该没有任何错误。