开发者

Python ImportError on web hosting

开发者 https://www.devze.com 2023-01-27 13:14 出处:网络
I\'m fairly new to Python, so forgive me if I\'m missing something obvious. I have been using the Topia TermExtract package, and the code I wrote has been working fine on my local machine (Mac OS 10.

I'm fairly new to Python, so forgive me if I'm missing something obvious.

I have been using the Topia TermExtract package, and the code I wrote has been working fine on my local machine (Mac OS 10.6.5; Python 2.6). However, when I copy the entire directory, complete with package files, to my GoDaddy hosting, I get this error:

    File "test.py", line 2, in ?
    from topia.termextract import extract
  File "/home/DIRECTORY_HERE/topia/__init__.py", line 1, in ?
    import pkg_resources
ImportError: No module named pkg_resources

I'm not sure what I need to do to make this work. Here is the script I wrote:

import sys
from topia.termextract import extract
extractor = extract.TermExtractor()
extractor

extractor.filter = extract.DefaultFilter(singleStrengthMinOccur=1)
# join array into string from command-line arguments.
str = ' '.join(sys.argv)
x = extractor(str)
print "\nExtracted text:\n"
# for each extracted word, print it out.
for i in range(0, 开发者_开发问答len(x)):
   if ((x[i][0])[-3:] != ".py"):
      print x[i][0]

print "\n"

Thanks!


The pkg_resources package is part of setuptools. Install that on the hosting.


I got it. I had to install VirtualEnv. If anyone has a similar problem, check out this post:

How to install setuptools?

0

精彩评论

暂无评论...
验证码 换一张
取 消