How to create a python 2.7 environment variable? - python-2.7

I have multiple versions of python installed so I wanted to create a command for each of them. I created the variable "python27" as both a user and system variable with the path "C:\Python27" and also tried "C:\Python27\python.exe". In both cases cmd says 'python27' is not recognized as an internal or external command.
My batch file is simply "python27 path_to_py_file".

You need to create a batch file for this. For example:
#C:\Python27\python.exe %*
Save this as python27.bat in a directory referenced by the PATH environment variable and you are good to go.

Related

Setting environment variable for VS2017

I'm installing a software extension for VS2017 which requires me to create a batch file in order to set the 'TargetVisualStudioEdition' environment variable, in my case the variable should be set to Community.
What I did so far is to crate the following simple batch file:
set "%TargetVisualStudioEdition%"="Community"
Once I run it I receive:
set ""="Community"
Then, when I run the installer the installation stops because the environment variable has not been set.
Am I missing something?
don't think you need the %s wrapping the variable;
just do set VARIABLE = value
the %% is just to reference the variables.
if this variable will be shared among processes, use setx

Generate shell doesn't work on Windows Toolbox

I enabled Generate shell script on Toolbox and I am sure have added the C:\Windows to path environment variables.
But it claims the webstorm is not a program, why?
You need to add the path that you used to export the generated shell scripts.
Ex.: If you set the path of the "Generate shell scripts" option to "C:/Shell Scripts" (without quotes of course); You need to add this path to your environment variables
What about changing your shell location to A custom path but not the system's path(e.g. c:\myshells)
then add your path to the system environment.
The "Select" function of my toolbox is not working, I need to fill the path on myself.

How to setup environment to use two python addons package

I have a task to integrate several different python script into the project.
Let's say python_1 and python_2 script.
To run the python_1, I need to set up environment using
module add python/2.7-addons-argparse (otherwise, some module can't be imported)
To run python_2, I need to do the setup as
module add python/2.7-addons-jinja2.
I will call both python1 and python2 within a Makefile, "module add" within
the Makefile will change the build environment whose impact is big. So I would
like to set-up python environment ready and then proceed to the Makefile
Module add one package will override the previous one, how to use both addons packages?
Thanks.
Finally, I just set-up the env variable of PYTHONPATH to include both of the python/2.7-addons-argparse and python/2.7-addons-jinja2. Within the makefile, I first use the following string command to extract them
string(REGEX MATCH "[:^]/.addons-argparse.[$:]" ARGPARSE_PATH ${OLD_PYTHONPATH})
and
string(REGEX MATCH "[:^]/.addons-jinja2.[$:]"JINJA2_PATH ${OLD_PYTHONPATH})
When I want to run python_1, I set it as:
SET(ENV{PYTHONPATH} "${ARGPASE_PATH}:${OLD_PYTHONPATH}")
For python_2, I set it as:
SET(ENV{PYTHONPATH} "${JINJA2_PATH}:${OLD_PYTHONPATH}")
Then It's OK.

Setting a VS2010 environment variable from a batch file?

I'm using a batch file to define some variables that will be used in my program.
I want the batch file to change the environment variable and use it in my code , but it's just now working - the macro is not being changed.
to be more specific and clear :
I have a program that creates a DLL and sets it's version
In the common setting of the project - I created a new macro (Common properties->User macros) : TEST_VER = 5
now I want to add a batch file , that will run in the pre-build command and change the value of TESTER
I wrote this in the batch file:
set TEST_VER=9
and used the path of the batch in the pre-build.
BUT it doesn't recognize it.
and still uses 5 as the value
I though doing :
propeties of the project - > resourcses ->general
and add : TEST_VER=$(TEST_VER)
and still didn't work
is there a way to do it??
thanks!!
When Visual Studio starts a program, it runs that program in a new sub-process. In this case, that's a new CMD.EXE, the command prompt shell. Changes made to the environment in a sub-process, a child, have no effect on the parent. Visual Studio has its own set of environment variables which it inherited when it started. Your batch file can't change those values. You can't do what you want the way you're doing it.

Embedding Lua: how to programatically save a script to a folder, how to compile a script?

I am embedding Lua in a C++ application, and I am using luaL_dofile to load a script
However, I cannot seem to find documentation on the functions to use to:
Compile a script (and save byte stream to a specified folder)
Save a script to a specified folder
last but not the least, when I use luaL_dofile to load a script into the Lua engine, if the loaded script has a line that loads a module for example:
require 'strict'
which directory would the script.lua (or its compiled version) be loaded from?
Look up luaL_loadfile and lua_dump. See also test/luac.lua.
For the question about where Lua looks for modules require'd: It depends on package.path and package.cpath variables, which can be influenced by the environment variables LUA_PATH and LUA_CPATH.