pythonpath

Aptana Python stdlib issue with virtualenv

不羁的心 提交于 2020-01-30 10:34:25
问题 I recently started working on a project using just vim as my text editor with a virtualenv setup. I installed a few API's on this virtualenv from GitHub. Eventually, the project got a little bigger than vim could handle so I had to move the project to an IDE. I chose Aptana Studio 3. When I started up Aptana, I pointed the project directory to the virtualenv folder that I had created to house my project. I then pointed the interpreter at the Python executable in App/bin (created from

Resolve conflicting package names in Python

元气小坏坏 提交于 2020-01-30 03:54:48
问题 Let's say we have two different Python packages from the same vendor, named with the same name -- foo . One is installed with pip and can be found in the /usr/lib/python/site-packages/foo directory, the second one is a system-wide dependency which you install with e.g. apt-get and the Python package ends up in /usr/lib/some-vendor-sdk/foo . Local and global foo do different things and I need them both to be importable in my source code, but I can only import one: $ python >>> import foo >>>

Developing and using the same Python on the same computer

白昼怎懂夜的黑 提交于 2020-01-14 03:26:14
问题 I'm developing a Python utility module to help with file downloads, archives, etc. I have a project set up in a virtual environment along with my unit tests. When I want to use this module on the same computer (essentially as "Production"), I move the files to the mymodule directory in the ~/dev/modules/ mymodule I keep all 3rd-party modules under ~/dev/modules/ contrib . This contrib path is on my PYTHONPATH, but mymodule is NOT because I've noticed that if mymodule is on my PYTHONPATH, my

unable to add spark to PYTHONPATH

主宰稳场 提交于 2020-01-13 09:56:08
问题 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/

How does python find a module file if the import statement only contains the filename?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-08 16:53:15
问题 Everywhere I see Python code importing modules using import sys or import mymodule How does the interpreter find the correct file if no directory or path is provided? 回答1: http://docs.python.org/3/tutorial/modules.html#the-module-search-path 6.1.2. The Module Search Path When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path . sys

PyQt5 - error while finding spec

眉间皱痕 提交于 2020-01-05 05:37:08
问题 I have come across many similar questions, so it appears to be a common problem. However, there are some variances among the question specifics and nothing I have found has worked for me so far. My issue is that I have installed PyQt5 and Python 3 on OS X El Capitan and that every time PyQt5 is run, I receive an error. //anaconda/bin/python3.5 : Error while finding spec for ' PyQt5.uic.pyuic ' ( <class 'ImportError'> : No module named ' PyQt5 ') As you can see, I've been using Anaconda

Add a single module to Python's import search path?

只谈情不闲聊 提交于 2020-01-05 02:55:13
问题 If I set PYTHONPATH to some path /path/to/modules/ , then the path is appended to sys.path and I can import modules/packages contained in /path/to/modules/ . However, if I only want access to a single module/package, then adding /path/to/modules/mymod.py or /path/to/modules/mypackage/ to sys.path does not work. So is there a way to add only a single module/package to the import search path, rather than adding the entire parent directory? I am asking because I need to import a single package

Python can't find modules with PYTHONPATH set

大兔子大兔子 提交于 2020-01-04 23:48:27
问题 I’m totally confused with new python 2.7.10. I've installed python 2.7.10 from tar.xz, which was downloaded from official site. Then I've linked /usr/local/bin/python2.7 with /usr/bin/python2.7 and /usr/bin/python, but when I try to import module, I get ImportError: No module named "module_name" . For example: python -c "import gtk" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named gtk But if: cd /usr/lib/python2.7/dist-packages/gtk-2.0/

How can I get Python to find ffprobe?

强颜欢笑 提交于 2020-01-04 07:03:10
问题 I have ffmpeg and ffprobe installed on my mac (macOS Sierra), and I have added their path to PATH. I can run them from terminal. I am trying to use ffprobe to get the width and height of a video file using the following code: import subprocess import shlex import json # function to find the resolution of the input video file def findVideoResolution(pathToInputVideo): cmd = "ffprobe -v quiet -print_format json -show_streams" args = shlex.split(cmd) args.append(pathToInputVideo) # run the

PYTHONPATH hell with overlapping package structures

被刻印的时光 ゝ 提交于 2020-01-01 07:05:14
问题 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