質問

I've used pip-2.7 install --user soundcloud to install the soundcloud module for Python 2.7 in Pythonanywhere.

In my Web2py App in Pythonanywhere, I get an error message when using import soundcloud, stating that the soundcloud module does not exist. Is it not possible to for Web2py to access a module installed on Pythonanywhere (that did not come pre-packaged)?

役に立ちましたか?

解決

As long as Web2Py can find it on the path then yes it will work. Before you try and import soundcloud you might need to do something like:

import sys
sys.path.append('/home/markstadt/.local/lib/python/site-packages')
import soundcloud

Printing out sys.path from inside the web2py application and printing soundcloud.file from in a bash shell should give you all the information you need in order to add the correct directory to your path.

[Edited to add some extra info]

Web2Py has it's own site-packages folder that is automatically added to the path. See here: https://www.pythonanywhere.com/forums/topic/178/ and How can I use modules in web2py?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top