Problems importing pyodbc module using bottle

2

I am working in windows and using bottle to connect to a database of SQL server , for it install pyodbc with pip install pyodbc however when I want to load the program I always get the error

ImportError: No module named pyodbc

I am using the version of python 2.7.14 and checking it appears that the pyodbc is installed in the folder of python27 inside lib, I read that installing Microsoft Visual C++ 9.0 for python solved the problem, however it still gives me that error.

    
asked by Fernando M. Goycochea 27.04.2018 в 15:44
source

1 answer

2

If what you put in the comment does not work for you, try doing this:

In your project in your project:

  

1- Press Ctrl + Alt + S to open the configuration.

     

2- In the column on the left, select Project interpreter   in the upper right part there is a list of binaries of Python that are in your system, select the correct one.

     

3- If necessary, click on the + button to install additional modules of python .

     

4- Validate.

  

SO Source: ImportError: No module named 'bottle' - PyCharm

If this does not work try to do the following:

Configuration of variables PYTHONPATH / PYTHONHOME

  

1- Right click on the computer icon in the start menu.

     

2- Go to properties.

     

3- On the left tab, go to Advanced System Settings.

     

4- In the window that appears, go to the Advanced tab.

     

5- Then at the bottom click on Environment variables.

     

6- Click on the list of user variables and start typing in Python , and repeat the system variables, just to make sure you do not have misconfigured variables for PYTHONPATH or PYTHONHOME .

     

7- Next, add new variables (I did it in System instead of User, although it can also work for the User):

     

PYTHONPATH , set to C:\Python27\Lib.PYTHONHOME ,

     

Established in C:\Python27 .

And you must also add % PYTHONHOME% to your path variable for this to work.

For example, if you installed in C:\Python27 , this can be set by the command line:

set PYTHONHOME=c:\Python27
set PYTHONPATH=c:\Python27\Lib
set PATH=%PYTHONHOME%;%PATH%

Make sure you do not have a% final% co.

  

OS Source: Python (Windows) - ImportError: No module named site

Additional to this:

You may have had an earlier version of '\' installed, for example the version: Python , and the path Python2.5 was set to PYTHONHOME . What you should do is rename to: Python2.5 for the version: C:\Python27\ and maybe you can solve the problem.

Regarding the Environment Variables:

  • Create a new variable called Python2.7.X . In this variable place something like this: PythonPath

If you can not get it that way, add:

  

C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\otras-carpetas-en-path

Look more:

  

C:\Python27;

As a final control, open a command prompt and enter %PY_HOME%;%PY_HOME%\Lib;%PY_HOME%\DLLs;%PY_HOME%\Lib\lib-tk; . You should see

>python [cualquier versión que estés usando]
  

If you need to change from one version to another, you only need to modify the variable Python to point to the correct directory. This is a bit easier to administer if you need multiple versions of PY_HOME installed.

Source SO: How to add to the pythonpath in windows 7?

Maybe one of these two solutions will help you. Regards!

    
answered by 27.04.2018 / 16:25
source