我在安装ibm_db时遇到问题。我收到了#34;当该文件已存在时无法创建文件:'测试' - > ' test_2'"
我使用的是Windows 7 x64,Python 3.6。目的是使用SQLAlchemy连接到db2数据库。我已经安装了ibm-db-sa数据库。
关于如何解决这个问题的任何想法都会很棒。
(.env) C:\Users\123456789\Documents\the_funny_app>pip install ibm_db
Collecting ibm_db
Downloading ibm_db-2.0.8.tar.gz (689kB)
100% |████████████████████████████████| 696kB 17.1MB/s
Building wheels for collected packages: ibm-db
Running setup.py bdist_wheel for ibm-db ... error
Complete output from command c:\users\123456789\documents\the_funny_app\.env\scripts\py
thon.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppDa
ta\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open
', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
de, __file__, 'exec'))" bdist_wheel -d C:\Users\139206~1\AppData\Local\Temp\tmpc
gu3awilpip-wheel- --python-tag cp36:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup.p
y", line 17, in <module>
os.rename('tests','test_2')
FileExistsError: [WinError 183] Cannot create a file when that file already ex
ists: 'tests' -> 'test_2'
----------------------------------------
Failed building wheel for ibm-db
Running setup.py clean for ibm-db
Complete output from command c:\users\123456789\documents\the_funny_app\.env\scripts\py
thon.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppDa
ta\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open
', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
de, __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup.p
y", line 17, in <module>
os.rename('tests','test_2')
FileExistsError: [WinError 183] Cannot create a file when that file already ex
ists: 'tests' -> 'test_2'
----------------------------------------
Failed cleaning build dir for ibm-db
Failed to build ibm-db
Installing collected packages: ibm-db
Running setup.py install for ibm-db ... error
Complete output from command c:\users\123456789\documents\the_funny_app\.env\scripts\
python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\App
Data\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'op
en', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(
code, __file__, 'exec'))" install --record C:\Users\139206~1\AppData\Local\Temp\
pip-g1oa_y2_-record\install-record.txt --single-version-externally-managed --com
pile --install-headers c:\users\123456789\documents\the_funny_app\.env\include\site\pytho
n3.6\ibm-db:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup
.py", line 17, in <module>
os.rename('tests','test_2')
FileExistsError: [WinError 183] Cannot create a file when that file already
exists: 'tests' -> 'test_2'
----------------------------------------
Command "c:\users\123456789\documents\the_funny_app\.env\scripts\python.exe -u -c "import
setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppData\\Local\\Temp\\pip-b
uild-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open', open)(__file__);cod
e=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
" install --record C:\Users\139206~1\AppData\Local\Temp\pip-g1oa_y2_-record\inst
all-record.txt --single-version-externally-managed --compile --install-headers c
:\users\123456789\documents\the_funny_app\.env\include\site\python3.6\ibm-db" failed with
error code 1 in C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\
答案 0 :(得分:6)
将评论转换为答案。
这是Win7上ibm_db v 2.0.8的一个已知问题,自修复以来,您可以安装固定版本或以前的版本。
安装固定版本:
pip install "ibm-db==2.0.8a"
安装以前的版本:
pip install "ibm-db<2.0.8"