import - (Python) Use a library locally instead of installing it -
import - (Python) Use a library locally instead of installing it -
script: i've written script in python sends tweets twitter uses 1 library called: tweepy after installing library works, great.
problem: host script on server not have privileges install anything great if can include locally folder i've got in. of right now, need include @ top of file is:
import tweepy the tweepy folder (does have __init__.py file believe important.
question: how can utilize library without installing it? want replace: import tweepy import local_folder/tweepy/*
this might python mutual sense, i'm stuck!
there few possibilities:
if know how install python modules, default distutils setup includes per-user installation option. run python setup.py install --user instead of python setup.py install. easiest, since not necessitate add-on of source code.
you run script directory of tweepy current working directory.
you add together environment variable named pythonpath whatever environment (e.g., shell) utilize run script, , create contain path tweepy.
if else fails, , want edit source code, you'll need edit sys.path. sys.path list of locations python code.
in code, write:
import sys sys.path.append("/path/to/your/tweepy/directory") import tweepy python import module
Comments
Post a Comment