Method: RubyPython.start_from_virtualenv
- Defined in:
- lib/rubypython.rb
.start_from_virtualenv(virtualenv) ⇒ Object
Starts the Python interpreter for a virtualenv virtual environment. Returns true
if the interpreter was started.
- virtualenv
-
The root path to the virtualenv-installed Python interpreter.
RubyPython.start_from_virtualenv('/path/to/virtualenv')
sys = RubyPython.import 'sys'
p sys.version # => "2.7.1"
RubyPython.stop
NOTE: In the current version of RubyPython, it is possible to change Python interpreters in a single Ruby process execution, but it is strongly discouraged as this may lead to segmentation faults. This feature is highly experimental and may be disabled in the future.
239 240 241 242 243 |
# File 'lib/rubypython.rb', line 239 def start_from_virtualenv(virtualenv) result = start(:python_exe => File.join(virtualenv, "bin", "python")) activate_virtualenv result end |