I am using Windows 11 and Python 3.13.2.
I have installed the ibm db2 client.
I added ibm_db_home value:
C:\Users\przyt>echo %IBM_DB_HOME%
c:\Program Files\IBM\SQLLIB
I installed ibm_db:
Name: ibm_db
Version: 3.2.6
Location: C:\Users\przyt\PycharmProjects\PythonProject\.venv\Lib\site-packages
Now using pycharm and in terminal
>>> import os
>>> os.add_dll_directory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')
<AddedDllDirectory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')>
>>> import ibm_db
>>> quit
No problem, all seems ok.
When doing this in regular command window,
C:\Users\przyt>py
Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.add_dll_directory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')
<AddedDllDirectory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')>
>>> import ibm_db
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
import ibm_db
ModuleNotFoundError: No module named 'ibm_db'
>>> quit
Is there a setting that should be done to have the same behavior in command window as in pycharm ps terminal?
Do you need to specify your project home path to specify where ibm_db is located? --- answer to reply --
python has been installed in
C:\Users\przyt\AppData\Local\Programs\Python\Python313\python.exe
when installing pycharm it requested where it was installed and created this .venv that keeps also a pyhon.exe.
if i look in settings it indicates base python = Appdata... of type venv and location is this .venv scripts folder and sys.executable is pointing to this C:\Users\przyt\PycharmProjects\PythonProject.venv\Scripts\python.exe -
so if I use the python from the venv path and import ibm_db it is ok. is this python a real copy or virtual ?
do i need the original installed python ?
best regards, Guy
I am using Windows 11 and Python 3.13.2.
I have installed the ibm db2 client.
I added ibm_db_home value:
C:\Users\przyt>echo %IBM_DB_HOME%
c:\Program Files\IBM\SQLLIB
I installed ibm_db:
Name: ibm_db
Version: 3.2.6
Location: C:\Users\przyt\PycharmProjects\PythonProject\.venv\Lib\site-packages
Now using pycharm and in terminal
>>> import os
>>> os.add_dll_directory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')
<AddedDllDirectory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')>
>>> import ibm_db
>>> quit
No problem, all seems ok.
When doing this in regular command window,
C:\Users\przyt>py
Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.add_dll_directory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')
<AddedDllDirectory('C:\\Users\\przyt\\PycharmProjects\\PythonProject\\.venv\\Lib\\site-packages\\clidriver\\bin')>
>>> import ibm_db
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
import ibm_db
ModuleNotFoundError: No module named 'ibm_db'
>>> quit
Is there a setting that should be done to have the same behavior in command window as in pycharm ps terminal?
Do you need to specify your project home path to specify where ibm_db is located? --- answer to reply --
python has been installed in
C:\Users\przyt\AppData\Local\Programs\Python\Python313\python.exe
when installing pycharm it requested where it was installed and created this .venv that keeps also a pyhon.exe.
if i look in settings it indicates base python = Appdata... of type venv and location is this .venv scripts folder and sys.executable is pointing to this C:\Users\przyt\PycharmProjects\PythonProject.venv\Scripts\python.exe -
so if I use the python from the venv path and import ibm_db it is ok. is this python a real copy or virtual ?
do i need the original installed python ?
best regards, Guy
Share Improve this question edited Mar 31 at 7:53 Guy Przytula asked Mar 30 at 17:39 Guy PrzytulaGuy Przytula 291 silver badge6 bronze badges 2 |1 Answer
Reset to default 0in the setting : I specified select existing interpreter
installed ibm_db from regular command window
now all is ok - i can use sql from both command window and pycharm
many thanks for all help, Guy
pycharm
may have own Python and it may have installed Python moduleibm_db
. You could checksys.executable
to get/full/path/to/python
and use it to run code/full/path/to/python script.py
and to install modules/full/path/to/python -m pip install ...
– furas Commented Mar 30 at 20:45.venv
then it should have special command to activate this venv - and then it should use modules installed in.venv
- maybe.venv/bin/activate
– furas Commented Mar 30 at 20:47