DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 19th May 2022
gordon.f gordon.f is offline
Port Guard
 
Join Date: Oct 2021
Posts: 27
Default How to activate virtual environment?

Hello,

I was trying to activate the virtual environment that I've created with python as local user and even as root but in both situations I got this message:

ksh: ./myenv/bin/activate: cannot execute - Permission denied

What seems to be the problem?
Reply With Quote
  #2   (View Single Post)  
Old 20th May 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,638
Default

I'll guess:

The file you are attempting to execute is not marked as executable in the file system.
Reply With Quote
  #3   (View Single Post)  
Old 20th May 2022
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 290
Default

You don't execute it, you source it.

'. ./myenv/bin/activate' for ksh.
Reply With Quote
  #4   (View Single Post)  
Old 20th May 2022
gordon.f gordon.f is offline
Port Guard
 
Join Date: Oct 2021
Posts: 27
Default

Quote:
Originally Posted by TronDD View Post
You don't execute it, you source it.

'. ./myenv/bin/activate' for ksh.
Thank you very much. It worked.

By the way could you please explain what is the difference between them?
Reply With Quote
  #5   (View Single Post)  
Old 20th May 2022
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 290
Default

It executes the commands in the current shell.

Why do that and not create a sub-shell? I'm not sure. I assume there is some practical difference that I don't know about.
Reply With Quote
  #6   (View Single Post)  
Old 21st May 2022
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,018
Default

One difference would be that by "sourcing" the commands as in

$ . script

the script can set environment variables that maintain their values in the current shell. Whereas if script is executable and run like

$ script

any environment changes it makes will be lost when the script finishes and you come back to the calling shell.
Reply With Quote
  #7   (View Single Post)  
Old 21st May 2022
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 290
Default

Is it not possible to make the resulting shell interactive? I thought I've seen some systems do this. Then when you exit the modified sub-shell, you get you original clean environment back.
Reply With Quote
Reply

Tags
python, venv

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
activate SMP on AMD64 philo_neo71 NetBSD General 8 18th December 2015 03:58 AM
armV7 activate turbo philo_neo71 NetBSD General 0 20th November 2015 03:50 AM
OpenBSD in virtualized environment jjstorm OpenBSD General 13 26th November 2014 06:04 AM
Xfce 4.8.0 desktop environment released J65nko News 4 18th January 2011 05:23 PM
Cannot activate partition in XP. bsdnewbie999 OpenBSD Installation and Upgrading 6 4th May 2009 05:21 PM


All times are GMT. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick