简体   繁体   中英

ImportError: No module named 'pymysql' in python 3.4.3

In the Visual Studio 2013 PTVS environment the command

import pymysql

work fine.

In the interpreter it gives the error: ImportError: No module named 'pymysql' in python 3.4.3 The solutions in the other questions on this site refering to this problem do not solve it. sys.path is:

>>> print(sys.path)
['', 'C:\\SVN\\MyPrograms\\ELS Positions Database\\CSVImport\\CSVImport1\\"C:\\SVN\\MyPrograms\\ELS Positions Database\\CSVImport\\CSVImport1\\env\\Lib\\site-packages\\pymysql-0.6.6-py3.4.egg', '
:\\SVN\\MyPrograms\\ELS Positions Database\\CSVImport\\CSVImport1\\env\\Lib\\site-packages\\pymysql-0.6.6-py3.4.egg\\pymysql', 'C:\\SVN\\MyPrograms\\ELS Positions Database\\CSVImport\\CSVImport1\
env\\Lib\\site-packages"', 'C:\\Windows\\system32\\python34.zip', 'C:\\Python34\\DLLs', 'C:\\Python34\\lib', 'C:\\Python34', 'C:\\Python34\\lib\\site-packages']
>>>

PYTHONPATH is:

PYTHONPATH="C:\SVN\MyPrograms\ELS Positions Database\CSVImport\CSVImport1\env\Lib\site-packages\pymysql-0.6.6-py3.4.egg;C:\SVN\MyPrograms\ELS Positions Database\CSVImport\CSVImport1\env\Lib\site-
ackages\pymysql-0.6.6-py3.4.egg\pymysql;C:\SVN\MyPrograms\ELS Positions Database\CSVImport\CSVImport1\env\Lib\site-packages"

I suspect I am making some syntax error but cannot find where. Help appreciated.

Many thanks.

I'm not sure, but I think that VS uses the 2.7 version of python and you are trying to use that library from the 3.4 version, try installing 2.7.

Or let me know what happen when you type import pymysql in the interpreter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM