pythonpath

cannot run python script file using windows prompt

大憨熊 提交于 2019-12-02 02:27:31
问题 I am trying to run a python script from the windows command prompt, but I receive the following error message: "python: can't open file 'pacman.py': [Errno 2] No such file or directory" when I try the command: c:\Program Files (x86)\Python27>python pacman.py This particular python script file pacman.py is located in the following folder: C:\Users\Chris\Dropbox\edX\CS188x\search So I added this folder to PYTHONPATH and confirmed that is was there using the following code: >>> import sys >>>

Setting python path for sublimerepl from sublime text?

被刻印的时光 ゝ 提交于 2019-12-01 19:26:07
问题 I use python portable along with sublime portable of a memory stick and decided to install sublime REPL however when trying to use python portable as the build path for sublimerepl it does not specify it. To put it simply I can't specify the sublimerepl python path like I can with straight sublime text! I have tried adding the following into SublimeREPL.sublime-settings "default_extend_env": {"PATH": "{PATH}:C:\\Users\\Andy\\Documents\\_Main\\M-Stick Backups\\08.07.13\\Computing\\Python

Where's the recommended place to put small python convenience modules

百般思念 提交于 2019-12-01 18:16:15
问题 I've amassed a small collection of small handy ad hoc scripts that I would like to have available to me in all my python projects and ipython interactive sessions. I would like to add to and clean up this collection without having to worry about making setup.py files and installing them formally. From the list of directories on the sys.path by default, what's the proper home for these scripts? 回答1: The user site directory should be the right directory for such things. python -m site --user

Where's the recommended place to put small python convenience modules

三世轮回 提交于 2019-12-01 17:54:42
I've amassed a small collection of small handy ad hoc scripts that I would like to have available to me in all my python projects and ipython interactive sessions. I would like to add to and clean up this collection without having to worry about making setup.py files and installing them formally. From the list of directories on the sys.path by default, what's the proper home for these scripts? The user site directory should be the right directory for such things. python -m site --user-site shows you the correct path for your platform. Usually its something like $HOME/.local/lib/python<version>

Installed module using pip, not found

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:41:39
I am trying to install a package called "simpleguitk" via pip. (On Ubuntu 16.04 with Python 3.5) After running sudo -H pip3 install simpleguitk it says installation is completed successfully. (Except for the pygame dependecy which is actually optional) Collecting simpleguitk Using cached SimpleGUITk-1.1.3.tar.gz Collecting Pillow>=2.0.0 (from simpleguitk) Using cached Pillow-3.4.2-cp35-cp35m-manylinux1_x86_64.whl Collecting pygame>=1.9.0 (from simpleguitk) Could not find a version that satisfies the requirement pygame>=1.9.0 (from simpleguitk) (from versions: 1.9.2.dev1, 1.9.2b7, 1.9.2b8) No

Python relative imports within a package not on the path

感情迁移 提交于 2019-12-01 05:29:07
问题 How can I import a file that is in a parent directory within a python package (that is not on the path) into a file in a child dir? I'm not totally clear on the vocabulary of python packaging so by way of example: dir1/ __init__.py runner.py in_dir1.py dir2/ __init__.py in_dir2.py dir1/in_dir1.py: def example(): print "Hello from dir1/in_dir1.example()" dir1/dir2/in_dir2.py import in_dir1 #or whatever this should be to make this work print "Inside in_dir2.py, calling in_dir1.example()" print

Installed module using pip, not found

隐身守侯 提交于 2019-12-01 04:26:47
问题 I am trying to install a package called "simpleguitk" via pip. (On Ubuntu 16.04 with Python 3.5) After running sudo -H pip3 install simpleguitk it says installation is completed successfully. (Except for the pygame dependecy which is actually optional) Collecting simpleguitk Using cached SimpleGUITk-1.1.3.tar.gz Collecting Pillow>=2.0.0 (from simpleguitk) Using cached Pillow-3.4.2-cp35-cp35m-manylinux1_x86_64.whl Collecting pygame>=1.9.0 (from simpleguitk) Could not find a version that

Force import module from Python standard library instead of PYTHONPATH default

China☆狼群 提交于 2019-11-30 17:46:16
I have a custom module in one of the directories in my PYTHONPATH with the same name as one of the standard library modules, so that when I import module_name , that module gets loaded. If I want to use the original standard library module, is there any way to force Python to import from the standard library rather than from the PYTHONPATH directory, short of renaming the custom module and changing every reference to point to the new name? The ideal solution would be to rename your module to something not in the standard library. You can also switch absolute imports on if you're on Python 2.5+

Python 2.x multiple version issues regarding PYTHONPATH

ⅰ亾dé卋堺 提交于 2019-11-30 14:39:43
There's Python 2.6 installed in the system. Now I want to use modules introduced in Python 2.7. Because I have no root privilege, I have built & installed 2.7 under my home directory ($HOME/local/) I added the following to my $HOME/.bashrc: export PATH=$HOME/local/bin:$PATH export PYTHONPATH=$HOME/local/lib/python2.7:$PYTHONPATH Now I encountered the two problems I want ask for workarounds. 1. Invoking Python 2.7 Newly installed Python 2.7 doesn't find 2.6 modules in system's library path (/usr/lib/python2.6/site-packages/). Should I add it to PYTHONPATH manually? Is there any nicer solution?

python - os.getenv and os.environ don't see environment variables of my bash shell

試著忘記壹切 提交于 2019-11-30 11:19:46
问题 I am on ubuntu 13.04, bash, python2.7.4 The interpreter doesn't see variables I set. Here is an example: $ echo $A 5 $ python -c 'import os; print os.getenv( "A" )' None $ python -c 'import os; print os.environ[ "A" ]' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'A' But everything works fine with the PATH variable: $ echo $PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr