Will I still able to install dependency package via Pip after Python 2 End of Life in 2020?

元气小坏坏 提交于 2020-04-11 04:36:03

问题


I'm using Python 2.7 and python pip to download all dependency packages from requirements.txt file for running my project. As we know the end of life of Python 2 in 2020, I have concern I could not install my dependency package from pip as pip install -r requirements.txt anymore.

One way I could think of is download all dependencies from requirements.txt and install them locally. Is it possible?

I have read a similar question Will PIP work for python 2.7 after its End of Life on 1st Jan 2020, but the possibility is still not clear for me whether or not pip still be working or not after 2020 EOL of Python 2.

How could I confirm that? How could I do to keep dependencies still be installed via pip in 2020 end of life of python 2? Thanks


回答1:


As seen in the question you linked, the pip maintainers are willing to support Python 2.7 for as long as reasonably feasible. Now you need to consider the other side: the index.

The default index for pip is PyPI, and I can't imagine that they would decide to delete existing artifacts or stop serving them just because the corresponding interpreter reached their end of life. I am pretty sure they already host and serve artifacts that are aimed at Python interpreters that have already reached their end of life. See for example the artifacts for lxml version 3.4.4 clearly show that it is still serving files aimed at Python 2.6 and 3.4, both of them have alredy reached EOL.

One way I could think of is download all dependencies from requirements.txt and install them locally. Is it possible?

This is definitely feasible as well. You could even go a step further and host your own index. See the following links for ideas:

  • https://packaging.python.org/guides/index-mirrors-and-caches/

  • https://packaging.python.org/guides/hosting-your-own-index/

  • https://pypi.org/project/devpi/
  • https://pypi.org/project/pypiserver/


来源:https://stackoverflow.com/questions/58696778/will-i-still-able-to-install-dependency-package-via-pip-after-python-2-end-of-li

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!