Installing Django and related packages on an offline computer

天涯浪子 提交于 2019-12-01 13:47:44

问题


I'm using win7, python 2.7 and I have a project with several packages running. I wanted to move the project to my friends laptop (which can't access to internet, not an option). so I downloaded Python/Django/All required packages, Installed python and run python setup.py install in each package directory.

I've found that some packages, even after I download them, requires somethings from the internet to be downloaded and causes error. so:

How can I download a package and all it's dependencies or what ever it needs to be installed offline?


回答1:


This is how you can do it

  • Install Django and all related packages to a Python virtual environment

  • Run pip freeze > requirements.txt which will list all installed packages and their versions in this file

  • Use pip wheel -r requirements.txt command which builds a wheelhouse folder of the package list

  • Zip this folder

  • Go to your friend's computer, unzip

  • create virtual environment and run pip install wheelhouse/* (Install all packages from the wheelhouse)

More about pip wheel.

Python and pip needs to be separately copied and installed.



来源:https://stackoverflow.com/questions/34704163/installing-django-and-related-packages-on-an-offline-computer

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