我正在尝试在 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
最初错误是'无法导入名称'常量''然后我运行了easy_install常量,现在错误就是上面的错误。
修改 仔细看后,我看到他们说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
答案 0 :(得分:0)
我认为你正在安装python2版本。
请改为尝试:
easy_install pymysql3