1

我正在尝试在windows 64 位上为python 3.3设置pymysql

我设法使用https://pypi.python.org/pypi/distribute#downloads安装了 easy_install我做了一个python Distribute_setup.py然后easy_install开始工作。

现在每当我尝试做easy_install pymysql我得到

Downloading/unpacking pymysql
  Downloading PyMySQL-0.5.tar.gz
  Running setup.py egg_info for package pymysql
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "c:\users\cc\appdata\local\temp\pip-build-Cc\pymysql\setup.py", line 7, in <module>
        version_tuple = __import__('pymysql').VERSION
      File ".\pymysql\__init__.py", line 28, in <module>
        from constants import FIELD_TYPE
    ImportError: cannot import name FIELD_TYPE
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

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

  File "c:\users\cc\appdata\local\temp\pip-build-Cc\pymysql\setup.py", line 7, in <module>

    version_tuple = __import__('pymysql').VERSION

  File ".\pymysql\__init__.py", line 28, in <module>

    from constants import FIELD_TYPE

ImportError: cannot import name FIELD_TYPE

----------------------------------------
Command python setup.py egg_info failed with error code 1 in c:\users\cc\appdata\local\temp\pip-build-Cc\pymysql
Storing complete log in C:\Users\Cc\pip\pip.log

最初的错误是'could not import name 'constants'' 然后我运行了easy_install constants,现在错误是上面的那个。

编辑 仔细一看,我看到他们说python 3.3要做

echo "Building Python 3.0 version in ./py3k..."
rm -fr ./py3k
mkdir py3k
cp -rf pymysql py3k/
cp setup.py py3k/
cp setup.py.py3k.patch py3k/
cp CHANGELOG py3k/
cp README.rst py3k/
cp LICENSE py3k/
cd py3k
2to3 .|patch -p0
patch setup.py setup.py.py3k.patch
cd ..

知道如何在 Windows 中执行此命令2to3 .|patch -p0

4

1 回答 1

0

我认为您正在安装 python2 版本。

试试这个:

easy_install pymysql3

于 2013-09-12T21:17:06.837 回答