我用以下方法创建了virtualenv:

mkvirtualenv -p /usr/bin/python3.4 django

之后,我尝试安装pysqlite:
pip install pysqlite

但是我得到了:
Downloading/unpacking pysqlite
  Downloading pysqlite-2.6.3.tar.gz (76kB): 76kB downloaded
  Running setup.py (path:/home/sigo/.virtualenvs/django/build/pysqlite/setup.py) egg_info for package pysqlite
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85
        print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
                                                                           ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85

    print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."

                                                                       ^

SyntaxError: invalid syntax

似乎pip尝试使用python2。我该如何解决?

最佳答案

没有适用于Python 3.x的pysqlite的公共(public)版本。对于Python 3.x,标准库中的sqlite3模块是pysqlite的最新版本。

关于python - 在具有python3支持的virtualenv中安装pysqlite,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23181197/

10-10 05:23