Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Jython安装Pyodbc?_Python_Ms Access_Jython_Pyodbc - Fatal编程技术网

Python 使用Jython安装Pyodbc?

Python 使用Jython安装Pyodbc?,python,ms-access,jython,pyodbc,Python,Ms Access,Jython,Pyodbc,平台:Windows 7(64位),Jython版本2.7.10“最终版本”。 目前正在使用java.sql类访问MS access数据库 在将来的某个时候,我想转向Linux。在将来的某个时候,我想转到MySQL/MariaDB 我认为使用一种更具python风格的方式会更好,而且Pyodbc似乎是一种可行的方式 这是我尝试使用pip来安装它: D:\apps\jython2.7.0\bin>pip install pyodbc Downloading/unpacking pyodbc

平台:Windows 7(64位),Jython版本2.7.10“最终版本”。
目前正在使用java.sql类访问MS access数据库

在将来的某个时候,我想转向Linux。在将来的某个时候,我想转到MySQL/MariaDB

我认为使用一种更具python风格的方式会更好,而且Pyodbc似乎是一种可行的方式

这是我尝试使用pip来安装它:

D:\apps\jython2.7.0\bin>pip install pyodbc
Downloading/unpacking pyodbc
  Downloading pyodbc-3.0.10.tar.gz (68kB): 68kB downloaded
  Running setup.py (path:C:\Users\Chris\AppData\Local\Temp\pip_build_Chris\pyodb
c\setup.py) egg_info for package pyodbc

    warning: no files found matching 'tests\*'
    warning: no files found matching 'README.rst'
Installing collected packages: pyodbc
  Running setup.py install for pyodbc
    building 'pyodbc' extension
    error: Compiling extensions is not supported on Jython
    Complete output from command D:\apps\jython2.7.0\bin\jython.exe -c "import s
etuptools, tokenize;__file__='C:\\Users\\Chris\\AppData\\Local\\Temp\\pip_build_
Chris\\pyodbc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).
read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Chri
s\AppData\Local\Temp\pip-xb4a39-record\install-record.txt --single-version-exter
nally-managed --compile:
    running install

running build

running build_ext

building 'pyodbc' extension

error: Compiling extensions is not supported on Jython

----------------------------------------
Cleaning up...
←[31mCommand "D:\apps\jython2.7.0\bin\jython.exe -c "import setuptools, tokenize
;__file__='C:\\Users\\Chris\\AppData\\Local\\Temp\\pip_build_Chris\\pyodbc\\setu
p.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\
n', '\n'), __file__, 'exec'))" install --record C:\Users\Chris\AppData\Local\Tem
p\pip-xb4a39-record\install-record.txt --single-version-externally-managed --com
pile" failed with error code 1 in C:\Users\Chris\AppData\Local\Temp\pip_build_Ch
ris\pyodbc
←[0m←[31mStoring debug log for failure in C:\Users\Chris\.pip\pip.log
←[0m
D:\apps\jython2.7.0\bin>
有人知道这是否可以补救/解决吗?

对于使用Jython以Python方式访问数据库,有人有其他建议吗?

因为您运行的是Jython,所以您身处Java世界。那就是JDBC;ODBC用于C(CPython)世界中的项目。您不需要使用pyodbc,而是需要:


除非您使用的是CPython(“标准默认”版本),否则pyodbc将无法工作。你使用Jython有什么特别的原因吗?大多数人只有在真正需要JVM或特定JAR/WAR时才使用它。

当您使用Linux时,您将不再有可用的Microsoft Access ODBC驱动程序(仅限Windows)。在非Windows平台上使用Access数据库还有其他ODBC选项,但它们可能不太理想

对于真正的跨平台解决方案,您可以将Jython与JDBC驱动程序一起使用,另一个答案如下:


谢谢你的链接。。。我完全支持Jython,因为那样你就能两全其美。加上真正的并发性。。。再加上数千个精心设计的Java类。。。加上Java和Python生态系统中的所有库、实用程序类等。我只希望Jython的天才们迟早会推出Jython3!