pythonpath

Django Management Command ImportError

耗尽温柔 提交于 2019-12-04 10:34:00
I have problem with imported module into my qsl/management/commands/<customcommand>.py file. in fact, my app structure is : qsl/management/commands/ : dir for my management commands qsl/management/jobs/ : dir for my mangement jobs jobs are python classes that contains the job i want to be done in the coresponding command e.g: news command in qsl/management/commands/ imports news job in qsl/management/jobs/ my error when i want to execute python manage.py news is an importerror : no module named management.jobs.news Make sure that all the folders have a __init__.py in them so that they can be

Split Python source into separate directories?

北城余情 提交于 2019-12-04 10:13:26
Here are some various Python packages my company "foo.com" uses: com.foo.bar.web com.foo.bar.lib com.foo.zig.web com.foo.zig.lib com.foo.zig.lib.lib1 com.foo.zig.lib.lib2 Here's the traditional way to store the source on disk: pysrc/ com/ foo/ bar/ web/ lib/ zig/ web/ lib/ lib1/ lib2/ PYTHONPATH=pysrc But for organizational purposes (different teams, different revision control, etc.), we want to store these as follows: bar/ pysrc/ com/ foo/ bar/ web/ lib/ zig/ pysrc/ com/ foo/ zig/ web/ lib/ lib1/ lib2/ PYTHONPATH=bar/pysrc:zig/pysrc The question is: Are there any issues with this second

python, change user site directory or install setup.py --prefix with --user

雨燕双飞 提交于 2019-12-04 08:03:17
I'd want to install python modules as non-root user like this $ pip install -I --install-option="--prefix=~/usr" scipy Unfortunately this usually does not work unless you specify --user . But --user can't be used together with --prefix . Using --user only (without --prefix ) installs to ~/.local which I find ugly because I have a well maintained ~/usr and don't want to add even more stuff to my env to make ~/.local usable too. So my questions: How can I let --prefix and --user work together for setup.py or how else could setup.py succeed without using --user ? Or can I change the user site

Why does virtualenv inherit $PYTHONPATH from my shell?

两盒软妹~` 提交于 2019-12-04 05:42:26
So I'm migrating all my tools from python2 to python3.4 on an Ubuntu 14.04 machine. So far I've done the following: aliased python to python3 in my zshrc for just my user installed pip3 on the system itself (but I'll just be using virtualenvs for everything anyway so I won't really use it) changed my virtualenvwrapper "make" alias to mkvirtualenv --python=/usr/bin/python3 ('workon' is invoked below as 'v') Now curiously, and you can clearly see it below, running python3 from a virtualenv activated environment still inherits my $PYTHONPATH which is still setup for all my python2 paths. This

How to fix the python path

≡放荡痞女 提交于 2019-12-04 05:23:00
问题 I have python 2.7.2 installed on my Mac. I installed using python-2.7.2-macosx10.6.dmg I have only one instance of python. When i type in the terminal to find the python path , I get this : python Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os.path >>> os.environ['PYTHONPATH'].split(os.pathsep) Traceback (most recent call last): File "<stdin>",

permanently remove directory from python path

不问归期 提交于 2019-12-04 02:02:37
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? 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 PYTHONPATH", so it should be fairly safe even if there are others around your .bashrc. If you simply delete the line

Python: sharing common code among a family of scripts

痴心易碎 提交于 2019-12-03 18:35:42
问题 I'm writing a family of Python scripts within a project; each script is within a subdirectory of the project, like so: projectroot | |- subproject1 | | | |- script1.main.py | `- script1.merger.py | |- subproject2 | | | |- script2.main.py | |- script2.matcher.py | `- script2.merger.py | `- subproject3 | |- script3.main.py |- script3.converter.py |- script3.matcher.py `- script3.merger.py Now several of the scripts share some code. The shared code is best considered part of the project itself,

PYTHONPATH hell with overlapping package structures

丶灬走出姿态 提交于 2019-12-03 17:14:57
I'm having problems with my PythonPath on windows XP, and I'm wondering if I'm doing something wrong. Say that I have a project (created with Pydev) that has an src directory. Under src I have a single package, named common , and in it a single class module, named service.py with a class name Service Say now that I have another project (also created with Pydev) with an src directory and a common package. In the common package, I have a single script, client.py , that imports service. So in other words, two separate disk locations, but same package. I've noticed that even if I set my PYTHONPATH

WSGIPythonPath is not working

痞子三分冷 提交于 2019-12-03 12:40: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/> Order deny,allow Allow from all </Directory> ErrorLog /var/log/apache2/currentcost_error.log #

ERROR: virtualenvwrapper could not find virtualenv in your path

走远了吗. 提交于 2019-12-03 10:30:21
问题 I'm trying to create a virtualenv with virtualenvwrapper , but when I use mkvirtualenv I get the following : ERROR: virtualenvwrapper could not find virtualenv in your path I assumed it was a PYTHONPATH problem. But if I do a pip show virtualenv I get the following : --- Metadata-Version: 2.0 Name: virtualenv Version: 13.1.0 Summary: Virtual Python Environment builder Home-page: https://virtualenv.pypa.io/ Author: Jannis Leidel, Carl Meyer and Brian Rosner Author-email: python-virtualenv