gpt4 book ai didi

python - 未能安装 python 包(osmium)

转载 作者:行者123 更新时间:2023-12-05 07:21:19 25 4
gpt4 key购买 nike

我正在尝试将一个名为 osmium 的 python 包安装到我使用 venv 创建的虚拟环境中。激活虚拟环境并从虚拟环境的 Scripts 目录中调用

pip install osmium

失败(下面的错误消息)。我正在使用 pycharm 作为 IDE。尝试通过 IDE 安装 osmium 也失败。

有趣的是,我有一位同事使用相同的计算机和相同版本的 python 和 pycharm,他成功地安装了 osmium。他直接依赖 pycharm 创建的虚拟环境(我认为它使用 virtualenv 而不是 venv),从不使用 venv 并且没有问题。

我什至重装了 python 和 pycharm 都无济于事。我想知道这是怎么回事。为什么会发生这种情况?又是什么原因导致重装后还是失败(有没有python和pycharm的痕迹?)

错误信息是:

D:\virtual_envs\test_env\Scripts>activate
(test_env) D:\virtual_envs\test_env\Scripts>pip install osmium
Collecting osmium
Using cached https://files.pythonhosted.org/packages/65/ec/41bc12a33bc9feab921e5e21999fe30882288f2f4f8d8a4536dcd03e2c0b/osmium-2.15.2.tar.gz
Installing collected packages: osmium
Running setup.py install for osmium ... error
Complete output from command d:\virtual_envs\test_env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium\\setup.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\J84120~1\AppData\Local\Temp\pip-record-torhb0ih\install-record.txt --single-version-externally-managed --compile --install-headers d:\virtual_envs\test_env\include\site\python3.7\osmium:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\osmium
copying src\osmium\version.py -> build\lib.win32-3.7\osmium
copying src\osmium\__init__.py -> build\lib.win32-3.7\osmium
creating build\lib.win32-3.7\osmium\osm
copying src\osmium/osm\mutable.py -> build\lib.win32-3.7\osmium/osm
copying src\osmium/osm\__init__.py -> build\lib.win32-3.7\osmium/osm
creating build\lib.win32-3.7\osmium\replication
copying src\osmium/replication\server.py -> build\lib.win32-3.7\osmium/replication
copying src\osmium/replication\utils.py -> build\lib.win32-3.7\osmium/replication
copying src\osmium/replication\__init__.py -> build\lib.win32-3.7\osmium/replication
running build_ext
-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found Protozero: C:/Users/J84120841/AppData/Local/Temp/pip-install-3_44nlf3/osmium/contrib/protozero/include (found suitable version "1.6.7", minimum required is "1.5.1")
CMake Warning at cmake/FindOsmium.cmake:127 (message):
Osmium: Can not find some libraries for PBF input/output, please install
them or configure the paths.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)


-- Could NOT find EXPAT (missing: EXPAT_LIBRARY EXPAT_INCLUDE_DIR)
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Warning at cmake/FindOsmium.cmake:153 (message):
Osmium: Can not find some libraries for XML input/output, please install
them or configure the paths.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)


CMake Error at D:/virtual_envs/test_env/Lib/site-packages/cmake/data/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Osmium (missing: ZLIB_FOUND EXPAT_FOUND BZIP2_FOUND) (found
suitable version "2.15.1", minimum required is "2.14")
Call Stack (most recent call first):
D:/virtual_envs/test_env/Lib/site-packages/cmake/data/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindOsmium.cmake:278 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/J84120841/AppData/Local/Temp/pip-install-3_44nlf3/osmium/build/temp.win32-3.7/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/J84120841/AppData/Local/Temp/pip-install-3_44nlf3/osmium/build/temp.win32-3.7/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\J84120~1\AppData\Local\Temp\pip-install-3_44nlf3\osmium\setup.py", line 150, in <module>
zip_safe=False,
File "d:\virtual_envs\test_env\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "d:\virtual_envs\test_env\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\J84120~1\AppData\Local\Temp\pip-install-3_44nlf3\osmium\setup.py", line 67, in run
self.build_extension(ext)
File "C:\Users\J84120~1\AppData\Local\Temp\pip-install-3_44nlf3\osmium\setup.py", line 110, in build_extension
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
File "C:\Users\J84120841\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\J84120~1

\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium\\build\\lib.win32-3.7', '-DPYTHON_EXECUTABLE=d:\\virtual_envs\\test_env\\scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium\\build\\lib.win32-3.7', '-DOSMIUM_INCLUDE_DIR=C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium/contrib/libosmium/include', '-DPROTOZERO_INCLUDE_DIR=C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium/contrib/protozero/include', '-DPYBIND11_PREFIX=C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium/contrib/pybind11']' returned non-zero exit status 1.

----------------------------------------
Command "d:\virtual_envs\test_env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\J84120~1\\AppData\\Local\\Temp\\pip-install-3_44nlf3\\osmium\\setup.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\J84120~1\AppData\Local\Temp\pip-record-torhb0ih\install-record.txt --single-version-externally-managed --compile --install-headers d:\virtual_envs\test_env\include\site\python3.7\osmium" failed with error code 1 in C:\Users\J84120~1\AppData\Local\Temp\pip-install-3_44nlf3\osmium\
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(test_env) D:\virtual_envs\test_env\Scripts>

最佳答案

问题在于开发包的操作系统依赖性。来自documentation ,您可以获得在错误消息中也看到的库名称

    sudo apt-get install build-essential cmake libboost-dev \
libexpat1-dev zlib1g-dev libbz2-dev

该命令适用于基于 Debian 的发行版。所以你必须找到 MS Windows 版本

Bzip2

    http://gnuwin32.sourceforge.net/packages/bzip2.htm

Zlib

    http://gnuwin32.sourceforge.net/packages/zlib.htm

expat 作为 NuGet 包

    https://www.nuget.org/api/v2/package/expat.v141/2.2.6

ZeroC Ice for VisualStudio 有一个选项

关于python - 未能安装 python 包(osmium),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56958847/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com