在Heroku上手动删除Python包(Manually remove Python package

2019-07-20 10:33发布

我正在运行heroku push master ,并得到了这一点:

 ----- Python app detected
 ----- No runtime.txt provided; assuming python-2.7.3.
 ----- Using Python runtime (python-2.7.3)
 ----- Installing dependencies using Pip (1.2.1)
        Downloading/unpacking Django-1.5c2 from https://www.djangoproject.com/download/1.5c2/tarball (from -r
                                                                                                             requirements.txt (line 1))
          Cannot determine compression type for file /tmp/pip-rYIGHS-unpack/tarball.ksh
          Running setup.py egg_info for package Django-1.5c2

        Installing collected packages: Django-1.5c2
          Running setup.py install for Django-1.5c2
            changing mode of build/scripts-2.7/django-admin.py from 600 to 755

            changing mode of /app/.heroku/python/bin/django-admin.py to 755


            ========
            WARNING!
            ========

            You have just installed Django over top of an existing
            installation, without removing it first. Because of this,
            your install may now include extraneous files from a
            previous version that have since been removed from
            Django. This is known to cause a variety of problems. You
            should manually remove the

            /app/.heroku/python/lib/python2.7/site-packages/django

            directory and re-install Django.

        Successfully installed Django-1.5c2

我怎样才能删除以前的Django的包?

UPDATE:我requirements.txt:

https://www.djangoproject.com/download/1.5c2/tarball/**#egg=django**
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7

粗体文字固定上述警告。

更新2:由于Django的1.5正式发布,我只是用PIP冻结:

Django==1.5
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7

Answer 1:

其中,Heroku的缓存破包,有没有办法让出来我有问题。 Python的buildpack应该有某种冲厕这个缓存(cache_dir里)的支持,但事实并非如此。

有一种变通方法:遵循这些说明你的Python运行时改变,例如,3.3.0(这并不重要,如果你的应用程序实际上支持Python 3与否)。 然后改回为默认值。 改变你的Python运行,然后部署将迫使buildpack彻底删除缓存的行为。 据我所知,这是抹去此刻的高速缓存中的唯一可行的方法。



Answer 2:

目前推包virtenv到文件

pip freeze > requirements.txt

承诺

git commit -am 'update packages'

而推的Heroku

git push heroku

而herocu重建环境

Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 1.26 KiB, done.
Total 13 (delta 3), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking Flask==0.9 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Flask


文章来源: Manually remove Python package on Heroku