PIP安装到本地文件夹(pip install to a local folder)

2019-08-01 06:52发布

是否有可能包安装到任意的文件夹? 例如,我想包安装到本地文件夹,但它引发的错误,同样的错误出现与任何其他包

/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'

同样这个问题,表明它应该是工作,所以这里有什么问题?

Answer 1:

--prefix=需要是绝对路径。 这样做:

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

例如,应该没有任何错误。



文章来源: pip install to a local folder