我尝试使用python(在Windows上)安装cassandra-driver但是它失败并出现以下异常。有人可以帮我这个,
我还尝试过以下位置提到的手动安装过程&同样的错误, http://datastax.github.io/python-driver/installation.html
安装例外:
C:\Windows\System32>pip install cassandra-driver
Collecting cassandra-driver
Using cached cassandra-driver-3.9.0.tar.gz
Requirement already satisfied: six>=1.6 in c:\python27\lib\site-packages (from c
assandra-driver)
Requirement already satisfied: futures in c:\python27\lib\site-packages (from ca
ssandra-driver)
Building wheels for collected packages: cassandra-driver
Running setup.py bdist_wheel for cassandra-driver ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools,
tokenize;__file__='c:\\users\\user01\\appdata\\local\\temp\\pip-build-pa7rph\\
cassandra-driver\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.r
ead().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdi
st_wheel -d c:\users\user01\appdata\local\temp\tmpbqprncpip-wheel- --python-ta
g cp27:
Unable to find pgen, not compiling formal grammar.
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Test
s'
warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Test
s'
warning: no files found matching '*.h' under directory 'Cython\Debugger\Tests'
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driver
\setup.py", line 433, in <module>
run_setup(None)
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driver
\setup.py", line 431, in run_setup
**kw)
File "c:\python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 318, in __init
__
self.fetch_build_eggs(attrs['setup_requires'])
File "c:\python27\lib\site-packages\setuptools\dist.py", line 373, in fetch_
build_eggs
replace_conflicting=True,
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 851, in
resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1123, i
n best_match
return self.obtain(req, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1135, i
n obtain
return installer(requirement)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 441, in fetch_
build_egg
return cmd.easy_install(req)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 674, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 700, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 1120, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 1108, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: INCLUDE envir
onment variable is empty
----------------------------------------
Failed building wheel for cassandra-driver
Running setup.py clean for cassandra-driver
Complete output from command c:\python27\python.exe -u -c "import setuptools,
tokenize;__file__='c:\\users\\user01\\appdata\\local\\temp\\pip-build-pa7rph\\
cassandra-driver\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.r
ead().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" cle
an --all:
Unable to find pgen, not compiling formal grammar.
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Test
s'
warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Test
s'
warning: no files found matching '*.h' under directory 'Cython\Debugger\Tests'
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driver
\setup.py", line 433, in <module>
run_setup(None)
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driver
\setup.py", line 431, in run_setup
**kw)
File "c:\python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 318, in __init
__
self.fetch_build_eggs(attrs['setup_requires'])
File "c:\python27\lib\site-packages\setuptools\dist.py", line 373, in fetch_
build_eggs
replace_conflicting=True,
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 851, in
resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1123, i
n best_match
return self.obtain(req, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1135, i
n obtain
return installer(requirement)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 441, in fetch_
build_egg
return cmd.easy_install(req)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 674, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 700, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 1120, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", lin
e 1108, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: INCLUDE envir
onment variable is empty
----------------------------------------
Failed cleaning build dir for cassandra-driver
Failed to build cassandra-driver
Installing collected packages: cassandra-driver
Running setup.py install for cassandra-driver ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\user01\\appdata\\local\\temp\\pip-build-pa7rph
\\cassandra-driver\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f
.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" i
nstall --record c:\users\user01\appdata\local\temp\pip-inudnv-record\install-r
ecord.txt --single-version-externally-managed --compile:
Unable to find pgen, not compiling formal grammar.
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Te
sts'
warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Te
sts'
warning: no files found matching '*.h' under directory 'Cython\Debugger\Test
s'
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driv
er\setup.py", line 433, in <module>
run_setup(None)
File "c:\users\user01\appdata\local\temp\pip-build-pa7rph\cassandra-driv
er\setup.py", line 431, in run_setup
**kw)
File "c:\python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 318, in __in
it__
self.fetch_build_eggs(attrs['setup_requires'])
File "c:\python27\lib\site-packages\setuptools\dist.py", line 373, in fetc
h_build_eggs
replace_conflicting=True,
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 851,
in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1123,
in best_match
return self.obtain(req, installer)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 1135,
in obtain
return installer(requirement)
File "c:\python27\lib\site-packages\setuptools\dist.py", line 441, in fetc
h_build_egg
return cmd.easy_install(req)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", l
ine 674, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", l
ine 700, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", l
ine 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", l
ine 1120, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:\python27\lib\site-packages\setuptools\command\easy_install.py", l
ine 1108, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: INCLUDE env
ironment variable is empty
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\user01\\appdata\\local\\temp\\pip-build-pa7rph\\cassandra-driver\\setu
p.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users
\user01\appdata\local\temp\pip-inudnv-record\install-record.txt --single-versi
on-externally-managed --compile" failed with error code 1 in c:\users\user01\a
ppdata\local\temp\pip-build-pa7rph\cassandra-driver\
答案 0 :(得分:8)
我可以使用以下命令
成功安装cassandra-driver<强>命令:强>
pip install cassandra-driver --install-option="--no-cython"
以下是完整的安装日志(fyi):
C:\Windows\System32>pip install cassandra-driver --install-option="--no-cython"
c:\python27\lib\site-packages\pip\commands\install.py:194: UserWarning: Disablin
g all use of wheels due to the use of --build-options / --global-options / --ins
tall-options.
cmdoptions.check_install_build_global(options)
Collecting cassandra-driver
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py
:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Na
me Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation
failures. You can upgrade to a newer version of Python to solve this. For more
information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py
:122: InsecurePlatformWarning: A true SSLContext object is not available. This p
revents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. Fo
r more information, see https://urllib3.readthedocs.io/en/latest/security.html#i
nsecureplatformwarning.
InsecurePlatformWarning
Using cached cassandra-driver-3.9.0.tar.gz
Requirement already satisfied: six>=1.6 in c:\python27\lib\site-packages (from c
assandra-driver)
Requirement already satisfied: futures in c:\python27\lib\site-packages (from ca
ssandra-driver)
Skipping bdist_wheel for cassandra-driver, due to binaries being disabled for it
.
Installing collected packages: cassandra-driver
Running setup.py install for cassandra-driver ... done
Successfully installed cassandra-driver-3.9.0
答案 1 :(得分:0)
cassandra-driver显然需要cython。所以pip install cython
会解决这个问题。
答案 2 :(得分:0)
我使用以下命令在远程安装了cqlsh客户端,
sudo apt-get install build-essential python-dev python-pip libev4 libev-dev
sudo apt-get install cython3
sudo pip install cassandra-driver
sudo pip install cassandra-driver --install-option="--no-cython"
sudo pip install cqlsh; (Or cqlsh==5.0.3)
export CQLSH_NO_BUNDLED=TRUE
cqlsh 192.168.0.330 --cqlversion="3.4.2"
答案 3 :(得分:0)
因为我使用的是 virtualenv,所以上述方法都不适合我。即
yum install -y python-virtualenv
virtualenv-2.7 /opt/test
对我有用的是:
/opt/test/bin/pip install --upgrade pip
/opt/test/bin/pip install typing cython
/opt/test/bin/pip install cassandra-driver