开发者

Python module visiable only in iPython

开发者 https://www.devze.com 2023-01-24 22:43 出处:网络
I have used set PYTHONPATH=%PYTHONPATH%;dictionary_containing_modules to make some modules globaly visiable.

I have used set PYTHONPATH=%PYTHONPATH%;dictionary_containing_modules to make some modules globaly visiable.

I have a script importing the modules with import my_module.

When i run the script from the iPython shell (run my_script.py), i get no errors and the script runs as int开发者_开发技巧ended, but when I run the script from the command promt (windows) with python my_script.py I get the error:

ImportError: No module named my_module 

I checked with pwd that they use the same working directory.


Remember that you can dynamically change your system path from within your script, using sys.path or the site module. So maybe you want to add them to your script...

Or maybe you want to write a BAT or Python launcher script that sets the PYTHONPATH...

Or you want to edit the Windows environment variables (somewhere inside System properties Win+Break).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号