是否可以将软件包安装到任意文件夹中?例如,我试图将一个软件包安装到本地文件夹,但它会出现错误,其他软件包也会出现相同的错误。
/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'
此外,这个问题表明它应该可以工作,那么问题出在哪里呢?
pip install --install-option="--prefix=/tmp/temp-virtualenv" ipy
,没有任何错误。 (pip
版本:1.1)。使用wsgiref
会出现错误。 - Pedro Romanopip
传递--ignore-installed
开关,实际上不会出现wsgiref
的错误。pip install --install-option="--prefix=/tmp/temp-virtualenv" --ignore-installed wsgiref
也可以正常工作,没有任何错误。 - Pedro Romano--prefix
必须是绝对路径,而不是像您所拥有的相对路径。请参见新答案(如果可能,请删除现在无关的评论:谢谢!)。 - Pedro Romano