pythonpath

Importing from another directory

∥☆過路亽.° 提交于 2019-12-05 20:20:44
I am structuring my Python application with the following folder architecture (roughly following the outline here ): myapp: myapp_service1: myapp_service1_start.py ... myapp_service2: myapp_service2_start.py ... myapp_service3: myapp_service3_start.py ... common: myapp_common1.py myapp_common2.py myapp_common3.py ... scripts: script1.py script2.py script3.py ... tests: ... docs: ... LICENSE.txt MANIFEST.in README This is ideal file/folder hierarchy for me, however, I am confused on how to reference modules from outside folders. For instance, myapp_service1_start.py needs to reference function

permanently remove directory from python path

白昼怎懂夜的黑 提交于 2019-12-05 17:03:44
问题 I recently added some things to my python path that I don't want there using: export PYTHONPATH=$PYTHONPATH:/my/path You can use sys.path.remove to remove something in the path, but it's not 100% permanent like the way I added it with the command line statement above. what can I do to permanently remove directories from the python path? 回答1: If the line you mention is in your .bashrc, it should be safe to simply delete it. Exactly as it stands, what the line says is "add /my/path to

How to setup python path for 2.7 on mac?

我的梦境 提交于 2019-12-05 15:39:25
I am aware that, this question has been asked and answered many times. But, still i couldn't get rid of this. I found out the following info on my mac. cd /Library/Frameworks/Python.framework/Versions/ Current -> 2.7 3.6 whereispython /usr/bin/python which python /usr/bin/python which -a python /usr/bin/python /usr/bin/python python Python 2.7.10 (default) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. Even though, when i edit ~/.bash_profile as below # Setting PATH for Python 2.7 # The original

using pip to install packages locally in spite of satisfied global requirements

廉价感情. 提交于 2019-12-05 11:22:22
I am trying to use pip to install a package locally in ~/.local . The problem is that the package (in an older version) is already available globally on the system. Even though the global python packages directory is not in my PYTHONPATH , pip still refuses to install, thinking that the package requirement is satisfied. This is similar to the issue described here, except I am not using sudo so the solution does not apply: pip - Requirement already satisfied? If I do: pip install --user numpy It says: Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7

unable to add spark to PYTHONPATH

被刻印的时光 ゝ 提交于 2019-12-05 10:04:33
I am struggling to add spark to my python path: (myenv)me@me /home/me$ set SPARK_HOME="/home/me/spark-1.2.1-bin-hadoop2.4" (myenv)me@me /home/me$ set PYTHONPATH=$PYTHONPATH:$SPARK_HOME:$SPARK_HOME/python:$SPARK_HOME/python/build:$SPARK_HOME/bin (myenv)me@me /home/me$ python -c 'import sys; print(sys.path)' ['', '/home/me/.virtualenvs/default/lib/python2.7', '/home/me/.virtualenvs/default/lib/python2.7/plat-x86_64-linux-gnu', '/home/me/.virtualenvs/default/lib/python2.7/lib-tk', '/home/me/.virtualenvs/default/lib/python2.7/lib-old', '/home/me/.virtualenvs/default/lib/python2.7/lib-dynload', '

What's .pydistutils.cfg for?

橙三吉。 提交于 2019-12-05 01:20:55
I work on two servers, and on one server .pydistutils.cfg looks like: install_scripts=~/opt_old/bin install_data=~/opt_old/share install_lib=~/usr/lib/python2.6/site-packages I think, this creates problems with using pip and linking libraries on local versions of python. On the second server, the file is non existent, and I don't have any issues. Why do we need this file and why is PYTHONPATH not sufficient? I installed a local version of Python and renamed the file .pydistutils.cfg. Hence, it seems that the file is not that important. A pretty good write-up is here: http://bouktin.blogspot

How is the python module search path determined on Mac OS X?

こ雲淡風輕ζ 提交于 2019-12-04 21:50:12
问题 When a non built-in module is imported, the interpreter searches in the locations given by sys.path . sys.path is initialized from these locations (http://docs.python.org/library/sys.html#sys.path): the directory containing the input script (or the current directory) PYTHONPATH the installation-dependent default While the first two sources are straight-forward, can anyone explain how the third one works, and what possibilities there are for influencing it? Although I would be interested in a

WSGIPythonPath is not working

北战南征 提交于 2019-12-04 19:01:40
问题 I am deploying my web.py application on Apache2 with mod_wsgi. Here is my virt_host file, WSGIPythonPath /home/ubuntu/plotwatt/libplotwatt:/home/ubuntu/plotwatt/pwstage/src <VirtualHost *:20108> ServerAdmin gslabrails.dev.plotwatt.com DocumentRoot /var/www WSGIScriptAlias / /var/www/currentcost/server.py WSGIDaemonProcess currentcost user=ubuntu group=ubuntu processes=5 threads=3 WSGIProcessGroup currentcost WSGIApplicationGroup %{GLOBAL} AddType text/html .py <Directory /var/www/currentcost/

Python's 'site.py' gone after Yosemite upgrade. Is that okay?

时光毁灭记忆、已成空白 提交于 2019-12-04 18:13:42
The Yosemite (OS X 10.10) upgrade includes Python 2.7.6, and the process, as usual with Apple system updates, seems to completely replace the system packages directory, in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python This time, the process appears to have entirely omitted site.py . My understanding was that this file was essential to the functioning of Python , in particular, the proper construction of package search paths; but my Python (which uses nothing more than the Apple system Python and additional packages in site-packages ) works fine, and my paths remain

What should be my python packages path for a user install on MacOS?

≯℡__Kan透↙ 提交于 2019-12-04 11:30:48
I'm on Mac OS X and I've heard that to avoid global installation of packages (using sudo) that might cause problems with the python files that OS X uses, the path to install python packages must be different than that of OS X. Currently python executables are installed in : /usr/local/bin/ Pip installs modules over here : /usr/local/lib/python2.7/site-packages Python is used from here : /usr/local/bin/python Are these paths safe? If you are on OS X, you should also have Python in /usr/bin : $ which -a python /usr/local/bin/python /usr/bin/python If you are using brew , the first python should