Set environment variable in bat file

I tried to use a library (mapnik )and the python binding with it.

The library is installed at D:\install\gis\mapnik-v2.2.0, then I add the following variable to the environment variable through the control panel:

PATH: D:\install\gis\mapnik-v2.2.0\bin;D:\install\gis\mapnik-v2.2.0\lib


Then I run:

>>import mapnik

This worked.

However, I do not want to set the variable to the global environment variable, so I tried to create a bat file like this:


SET mapnik_path=D:\install\gis\mapnik-v2.2.0;
SET PATH=%PATH%;%mapnik_path%\lib;%mapnik_path%\bin;
SET PYTHONPATH=%PYTHONPATH%;%mapnik_path%\python\2.7\site-packages; 

Then once I tried to run a script who use mapnik I will run the bat first:

>>import mapnik

But I will get error:

ImportError: No module named mapnik


What's the problem?


What you listed as your script:

>>import mapnik

just can NOT be a script, because ">>import mapnik" should be a keyboard input, right?

You script should be like this:

call setup_mapnik_path.bat

Previous script call the first Batch file that define the variables, then return and execute python. After that, you enter ">>import mapnik" via keyboard.

Need Your Help

validation in tabbed pane of bootstrap theme

javascript jquery html css twitter-bootstrap

i am performing validations on the text fields i the given theme, i have 3 tabs, and the submit button is in the 3rd tab, the validation actually works but no notification for users like something is

Read string line-by-line (in Objective-C)

objective-c xcode string stringbuilder readline

What is a fast and simple way to read a string line-by-line?