Search code examples
pythonpippythonanywhere

Python anywhere modules not accessible outside main directory


In my attempts to create a web app with python anywhere I have discovered that my preferred module web.py is not preinstalled like other modules such as flask. Upon looking through some forums I came to the understanding that installation would occur in the following fashion in the hash console:

pip install --user web.py

It was however to my surprise that apparently:

Requirement already satisfied (use --upgrade to upgrade): web.py in /usr/local/lib/python2.7/dist-packages

Upon running the a python 2.7 shell in the main directory (if that is what is actually happening when clicking "New 2.7 Shell") I successfully imported 'web', however when running an identical 'import web' outside of the main directory in /site/run.py I was unsuccesful... Might someone inform me as to what is necessary to correct this problem?


Solution

  • I apologize for my stupidity... It turns out that pythonanywhere defaults to python 3.x and seeing as web.py is a 2.x module, it was unsuccessful. I can only hope that perhaps this post will help some equally unassuming individual such as myself in the future.