不同版本的python缺少pymssql

时间:2016-02-12 01:25:34

标签: python pymssql

我在/ 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的版本?

1 个答案:

答案 0 :(得分:0)

当您运行sudo pip时,您正在调用/usr/bin/python。不使用sudo安装您的软件包。我同意@Michael Frystacky - 使用virtualenv将使您免于再次使用sudo pip