简体   繁体   English

python&django_registration ::实际上是0.8时指向版本0.7

[英]python & django_registration:: pointing to verion 0.7 when it is in fact 0.8

so i am using django and the django_registration module. 所以我正在使用django和django_registration模块。

When i visit a page, I get this error: 当我访问页面时,出现此错误:

zipimport: can not open file C:\\development\\python\\lib\\site-packages\\django_registration-0.7-py2.7.egg zipimport:无法打开文件C:\\ development \\ python \\ lib \\ site-packages \\ django_registration-0.7-py2.7.egg

with

Python Path: Python路径:
['C:\\development\\PyCharm\\helpers\\pycharm', ['C:\\ development \\ PyCharm \\ helpers \\ pycharm',

'C:\\development\\python\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 'C:\\ development \\ python \\ lib \\ site-packages \\ setuptools-0.6c11-py2.7.egg',

... ...

'C:\\development\\python\\lib\\site-packages\\django_registration-0.7-py2.7.egg', 'C:\\ development \\ python \\ lib \\ site-packages \\ django_registration-0.7-py2.7.egg',

...] ...]

Where you'll notice the fourth line is referring to the 0.7 version! 您会注意到第四行指的是0.7版本!

The problem is, i am not using that version of django_registration. 问题是,我没有使用django_registration版本。 I am using the 0.8 version. 我正在使用0.8版本。 What had happened was that, on my windows machine, i used the easy_install django_registration command, which got me version 0.7, but only as an egg file. 发生的事情是,在我的Windows机器上,我使用了easy_install django_registration命令,该命令为我提供了0.7版,但仅作为蛋文件。 It didn't make a directory or anything like that. 它没有建立目录或类似的目录。

So i removed that by using easy_install -m django_registration For good measure, i deleted the django_registration_0.7.egg file (or whatever it was called, that name isn't precise) 因此,我通过使用easy_install -m django_registration删除了该文件。出于良好的考虑,我删除了django_registration_0.7.egg文件(或者不管它叫什么名字,名字都不准确)。

Then i went and manually downloaded the 0.8 version of django_registration from the main django_registration page: https://bitbucket.org/ubernostrum/django-registration/downloads 然后我去了,从django_registration主页上手动下载了django_registration的0.8版本: https ://bitbucket.org/ubernostrum/django-registration/downloads

And then ran the python build and install commands. 然后运行python build和install命令。 However, now my python seems to think it is using version 0.7! 但是,现在我的python似乎认为它正在使用版本0.7!

So, i suppose the questions are: how do i find where this python path is being set? 因此,我想的问题是:如何找到该python路径的设置位置? how do I tell django to use 0.8, not 0.7? 我如何告诉Django使用0.8,而不是0.7?

Incidentally, I don't have any funky "pythonpath" environment variables set, and i'm on windows 7 顺便说一句,我没有设置任何时髦的“ pythonpath”环境变量,并且我在Windows 7上

I'd really recommend using pip and virtualenvs to manage your dependencies and paths. 我真的建议使用pip和virtualenvs来管理您的依赖关系和路径。 Things like this just disappear. 这样的事情就消失了。

http://docs.python-guide.org/en/latest/dev/virtualenvs/ http://docs.python-guide.org/en/latest/dev/virtualenvs/
http://www.pip-installer.org/en/latest/index.html http://www.pip-installer.org/en/latest/index.html

I would use grep or ack to find where the path is set. 我将使用grep或ack查找设置路径的位置。 On Windows, you could try http://gnuwin32.sourceforge.net/packages/grep.htm 在Windows上,您可以尝试http://gnuwin32.sourceforge.net/packages/grep.htm

Ugh. 啊。

I think the situation resolved itself, but boy did it take time. 认为情况已经解决,但是男孩确实花了一些时间。

the problem was that, for whatever reason, easy-install wasn't picking up the 0.8 version, but the 0.7 version. 问题在于,无论出于何种原因,易安装不是选择0.8版本,而是选择0.7版本。 I waited a few weeks - i had other things to do than dig through the python classpath - and then re-easy-install'd the app. 我等了几周-除了挖掘python类路径以外,我还有其他事情要做-然后重新轻松安装该应用。 This time, easy-install picked up that there was a 0.8 version, wiped the 0.7 version from wherever, and yay! 这次,易于安装的版本有一个0.8版本,从任何地方都删除了0.7版本,是的! all is well. 一切都很好。

In case you want to do this super-manually though, try reading this stackoverflow item, which was of some use: Can we shed some definitive light on how python packaging and import works? 如果您想以超级手动方式进行操作,请尝试阅读一下stackoverflow条目,该条目很有用: 我们能否明确说明python打包和导入的工作方式?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM