this is my first post and I've been working with python for about a month now.
这是我的第一篇文章,我已经和python一起工作了大约一个月了。
Anyway I've been trying to import downloaded modules into python 2.7, such as django and mechanize, and I keep getting the same error telling me there is no such module. I downloaded both with pip and from I understand should be in the correct directories. A while ago I decided to simply copy and paste the django folder into the same folder I was saving my programs into, and that took care of the issue. That seems a bit messy though, having to save all of my modules into various folders. So I looked around * (and elseware) and pasted that same folder into a PYTHONPATH directory and that didn't solve the problem either. I apologize for the long question but I've been at it for a while now and tried a few different fixes. Any feedback would be greatly appreciated, thank you very much.
无论如何,我一直在尝试将下载的模块导入python 2.7,例如django和mechanize,我一直得到同样的错误,告诉我没有这样的模块。我用pip下载了两个,我明白应该在正确的目录中。前段时间我决定将django文件夹复制并粘贴到我保存程序的同一个文件夹中,并解决了这个问题。这看起来有点乱,不得不将我的所有模块保存到各种文件夹中。所以我查看了*(和elseware)并将相同的文件夹粘贴到PYTHONPATH目录中,但也没有解决问题。我为这个长期问题道歉,但我已经有一段时间了,并尝试了几个不同的修复。非常感谢任何反馈,非常感谢。
On a side note, default modules work fine, such as: math and os. Side note, I'm running kubuntu 14.04.
另外,默认模块工作正常,例如:math和os。旁注,我正在运行kubuntu 14.04。
Thanks again.
再次感谢。
1 个解决方案
#1
1
The standard Python solution to installing packages is to install pip (package manager) and virtualenv, then make a virtualenv for each project and install your packages in the virtualenv. The documentation for those projects is quite good and should be able to get you started.
安装软件包的标准Python解决方案是安装pip(软件包管理器)和virtualenv,然后为每个项目制作virtualenv并在virtualenv中安装软件包。这些项目的文档非常好,应该能够帮助您入门。
#1
1
The standard Python solution to installing packages is to install pip (package manager) and virtualenv, then make a virtualenv for each project and install your packages in the virtualenv. The documentation for those projects is quite good and should be able to get you started.
安装软件包的标准Python解决方案是安装pip(软件包管理器)和virtualenv,然后为每个项目制作virtualenv并在virtualenv中安装软件包。这些项目的文档非常好,应该能够帮助您入门。