pythonpath

Mac Swampy (Python learning module) install

六眼飞鱼酱① 提交于 2019-12-12 22:17:25
问题 I thought I would teach my kids programming and am using "Think Python" by Downey. The book is great except when he gets to installing "Swampy" a Turtle-like learning module. I've spent a few hours trying to figure it out--now I need help. Can anyone offer a clear, step-by-step set of instructions on how to install Swampy? Please assume zero prior knowledge of Unix, etc. I'm on OS X (10.6.6). Python is running fine. Tkinter is fine. Here are the overall installation instructions offered at

Python code runs from IDE, but not from terminal

痞子三分冷 提交于 2019-12-12 10:58:43
问题 My imports don't work when I try to run the code from Linux terminal. Specifically, imports from other packages in the same project. I know this is a PYTHONPATH issue, but I don't know how to diagnose it further or solve it. The code runs fine inside the IDE (eclipse). I am interested in a permanent solution, guessing it will involve editing .bashrc. I simply want to invoke scripts from command line, like python my_script.py os.environ["PYTHONPATH"] gives a key error in ipython terminal. I

Django system-wide install to virtualenv

淺唱寂寞╮ 提交于 2019-12-12 10:24:10
问题 I've recently deployed an application online using DigitalOcean single-click droplet setup which setup Django on Ubuntu with nginx and gunicorn. It came with a default django project which I've managed to change to my own. However, the default project doesn't use a virtualenv, it uses a system-wide install. So, the app only works if all the dependencies are installed on the system. I know this because if I uninstall django, it gives me an internal server error. I would like to use the python

GAE works but import webapp2 failed in Spyder

只谈情不闲聊 提交于 2019-12-12 05:16:31
问题 this is simple code to test the redirection in html.and I use Spyder to write Python Code. import webapp2 from valid_day import valid_day from valid_month import valid_month from valid_year import valid_year from html_escape import escape_html form = """ <form method="post"> What is your birthday? <br> <label> Month <input type="text" name="month" value="%(month)s"> </label> <label> Day <input type="text" name="day" value="%(day)s"> </label> <label> Year <input type="text" name="year" value="

Crontab issues with python script

倖福魔咒の 提交于 2019-12-12 04:23:54
问题 I have a script that runs perfectly from command line: /home/anaconda2/bin/python /project_folder/script.py I added some details below: $ echo $PYTHONPATH :/project_folder/ $ which python /home/anaconda2/bin/python Which runs the script perfectly, flawlessly. Then from within crontab (which has been successful for another script that didn't have local import issues) I can't get the script to run. Crontab of code that doesn't work: PYTHONPATH=/project_folder * * * * * /home/anaconda2/bin

modified PYTHONPATH not recognized by Anaconda Spyder

时光毁灭记忆、已成空白 提交于 2019-12-12 04:21:38
问题 I use my .bash_profile to add a directory to PYTHONPATH export PYTHONPATH="${PYTHONPATH}:/Users/selah/newdir" In my Anaconda installation of Spyder the path I added does not show up when I type: import sys sys.paths However when i do the same in Jupyter notebook, or terminal python it does show up. Why the discrepancy? Is there a way to get Spyder to recognize my modified PYTHONPATH? 回答1: ( Spyder developer here ) You need to start Spyder from the command line for your changes to be detected

Using cython extension once compiled [under Windows], how to use .pyd's?

余生颓废 提交于 2019-12-11 20:42:36
问题 I am used with compiling self-made python extensions under Linux using Cython. On Linux, I use distutils to produce a "myext.so", that I can then simply add to my PYTHONPATH and get the import myext python call available. Now, I am trying to get it working under Windows 7 (using Cython 0.18). I successfully ran distutils such that I now get a myext.pyd file. But it seems (http://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll) that adding the path to "myext.pyd" is not

Problems with PYTHONPATH

孤街浪徒 提交于 2019-12-11 16:31:57
问题 From the command line (Mac OS), when I execute 'echo $PYTHONPATH' I get: > /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 If I then enter the Python interpreter and do the following: >>> import os >>> os.environ['PYTHONPATH'] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'PYTHONPATH' Why would

Python path explained: import from a subpackage

最后都变了- 提交于 2019-12-11 12:18:23
问题 This questions is detailing a behavior that I can't explain to myself. src/package/__init__.py is empty but present. src/package/subpackage/__init__.py : pink = 'It works' src/package/test/test.py : import package.subpackage as subpackage # I also tried `import package.subpackage as subpackage print subpackage.pink Calling from src : python package/test/test.py just fails with ImportError: No module named subpackage . Please note that import package doesn't work either. NB: (Running an

Why can't nosetests find one the elements in sys.path?

前提是你 提交于 2019-12-11 12:14:09
问题 I have a series of unit tests that I'm running with nose . For some of my tests, I'd like to remove a module's path from the sys.path so there is no conflict with what I am testing. sys.path.remove('/path/to/remove/from/sys/path') If I run the Python interpreter and call sys.path , the '/path/to/remove/from/sys/path' is there in the list. However, once nosetests is called, the above code cannot find it and gives me a "not found in list" error. Why is nose not able to find the path in sys.path