简体   繁体   中英

Pybluex python bluetooth module installation error error in pycharm

I have to communate python with aurdino for this I am trying to install package pybluex but always it gave this error

  LINK : fatal error LNK1181: cannot open input file 'Irprops.lib'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\link.exe' failed with exit status 1181
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SHEKHA~1\\AppData\\Local\\Temp\\pycharm-packaging\\PyBluez\\setup.py'"'"'; __file__='"'"'C:\\Users\\SHEKHA~1\\AppData\\Local\\Temp\\pycharm-packaging\\PyBluez\\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\shekhani laptop\AppData\Local\Temp\pip-record-ku9uo755\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Python38-32\Include\PyBluez' Check the logs for full command output.

In my case I noticed that the Windows SDK version didn't have the 'irprops.lib' as it has been replaced according to: https://blogs.windows.com/windowsdeveloper/2019/11/19/windows-10-sdk-preview-build-19023-available-now/

Removal of IRPROPS.LIB

In this release irprops.lib has been removed from the Windows SDK. Apps that were linking against irprops.lib can switch to bthprops.lib as a drop-in replacement.

To solve it I installed a previous version of the Windows 10 SDK. If I had more time I probably would try to update the dependency to bthprops.lib;)

This is now fixed in the github repo but it looks like they haven't updated the pip package. installing from the repo directly worked without having to downgrade

  • I installed VS Code onto my windows 10 box.

  • I downloaded and installed in a separate step, the MS VS 10 build library. (It is big.)

  • Download the pybluez zip file from their github, and unzip it. Dont use pip to install it because pybluez's setup.py is now wrong (outdated).

  • Change pybluez library's setup.py file to say bthprops.lib because irprops.lib does not exist any more. (You can have your file editor search in the file for props.lib for convenience.)

  • I activated my projects python virtual environment.

  • At command line, in the new directory you extracted the lib to, run the usual python installation command for libraries: python setup.py install

This is what actually got it working here. The key it turns out, is to hand-modify the setup.py file, which you only can do by first downloading the zip file of pybluez, which contains a setup.py file that you can modify, instead of using pip, which you can't modify the setup.py file that's in there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM