我在/ usr / bin /
中有python2.7.3此版本可以无错导入pymssql
我在/ usr / local / bin /
中有python2.7.11导入pymssql
时此版本出错 $ sudo pip install pymssql
Requirement already satisfied (use --upgrade to upgrade): pymssql in /usr/local/lib/python2.7/dist-packages
Cleaning up...
$ python
Python 2.7.11 (default, Feb 9 2016, 14:42:25)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
/>>> import pymssql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pymssql
$ which python
/usr/local/bin/python
如何将pymssql安装到python2.7.11的版本?
答案 0 :(得分:0)
当您运行sudo pip
时,您正在调用/usr/bin/python
。不使用sudo
安装您的软件包。我同意@Michael Frystacky - 使用virtualenv将使您免于再次使用sudo pip
。