简体   繁体   中英

Module importing in python 2.7

this is my first post and I've been working with python for about a month now.

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 stackoverflow (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.

On a side note, default modules work fine, such as: math and os. Side note, I'm running kubuntu 14.04.

Thanks again.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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