简体   繁体   English

zope.deprectation:解决pydev,.pth文件和站点包的导入问题

[英]zope.deprectation: solve import issues with pydev, .pth files and site-packages

I'm using python 3.4.2 in a virtual environment. 我在虚拟环境中使用python 3.4.2。 I've setup pydev to use my virtual environment interpreter with the virtual environment's site-packages directory. 我已经将pydev设置为将我的虚拟环境解释器与虚拟环境的site-packages目录一起使用。

Everything is fine from the command line when I run the virtual environment's version of python. 当我运行虚拟环境的python版本时,在命令行上一切都很好。 I can import everything correctly. 我可以正确导入所有内容。

However, sometimes I have issues inside PyDev even though it's configured for the virtual environment. 但是,有时即使为虚拟环境配置了PyDev,我仍然遇到问题。

One big issue I am having is PyDev is not seeing zope.deprecation. 我遇到的一个大问题是PyDev没有看到zope.deprecation。 This is likely due to the fact that in site-packages, the zope directory does not have a init .py file. 这可能是由于以下事实:在站点包中,zope目录没有init .py文件。 In fact creating this file makes PyDev see zope.deprecation. 实际上,创建此文件使PyDev看到zope.deprecation。

In the site-packages directory the zope.deprecation package does come with zope.deprecation-4.1.1-py3.4-nspkg.pth and zope.deprecation-4.1.1-py3.4.egg-info which I assume are supposed to aid in setting up things correctly. 在site-packages目录中,zope.deprecation软件包的确随附了zope.deprecation-4.1.1-py3.4-nspkg.pth和zope.deprecation-4.1.1-py3.4.egg-info,我认为这是假定的帮助正确设置事物。

But PyDev doesn't seem to understand. 但是PyDev似乎不明白。

(I have a similar problem with the newrelic...it's directory structure under site-packages is not 'canoncial' but it also comes with a .pth file to help the interpreter understand where to find things). (我对newrelic有一个类似的问题。它在site-packages下的目录结构不是'canoncial'的,但是它还带有一个.pth文件,以帮助解释器了解在哪里找到东西的。)

My question is how do I get PyDev to understand the site-packages environment correctly? 我的问题是如何使PyDev正确理解站点包环境?

Manually touching a init .py is completely hacky... 手动触摸init .py完全是hacky ...

Thanks! 谢谢!

PyDev does not support namespace packages. PyDev不支持名称空间包。 Here is bug report https://sw-brainwy.rhcloud.com/tracker/PyDev/151 这是错误报告https://sw-brainwy.rhcloud.com/tracker/PyDev/151

By the way, PyCharm (great Python IDE) does support namespace packages since 2012 – 顺便说一下,自2012年以来,PyCharm(出色的Python IDE)确实支持名称空间包–

PyCharm has been updated to support the new language features of Python 3.3, including the new namespace packages. PyCharm已更新,以支持Python 3.3的新语言功能,包括新的名称空间包。

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

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