当我运行命令
pip install pyswisseph
安装swiss ephemeris的python扩展名,它给出了错误。
C:\WINDOWS\system32>pip install pyswisseph
Collecting pyswisseph
Using cached https://files.pythonhosted.org/packages/09/27/10ad652fa0e07fc89890142a6f900725e26cf02a24d8fd724015e08707b5/pyswisseph-2.00.00-2.tar.bz2
Building wheels for collected packages: pyswisseph
Running setup.py bdist_wheel for pyswisseph ... error
Complete output from command c:\users\narayana\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Narayana\\AppData\\Local\\Temp\\pip-install-wlypji8s\\pyswisseph\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Narayana\AppData\Local\Temp\pip-wheel-f31zjcrt --python-tag cp37:
Searching system libswe...
pkg-config not found
Using internal libswe
c:\users\narayana\appdata\local\programs\python\python37\lib\site-packages\setuptools\dist.py:398: UserWarning: Normalizing '2.00.00-2' to '2.0.0.post2'
normalized_version,
running bdist_wheel
running build
running build_ext
building 'swisseph' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\libswe
creating build\temp.win-amd64-3.7\Release\swephelp
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ilibswe -Iswephelp -Ic:\users\narayana\appdata\local\programs\python\python37\include -Ic:\users\narayana\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\include" /Tcpyswisseph.c /Fobuild\temp.win-amd64-3.7\Release\pyswisseph.obj -std=gnu99
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
pyswisseph.c
c:\users\narayana\appdata\local\programs\python\python37\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
**----------------------------------------
Failed building wheel for pyswisseph**
Running setup.py clean for pyswisseph
Failed to build pyswisseph
Installing collected packages: pyswisseph
Running setup.py install for pyswisseph ... error
Complete output from command c:\users\narayana\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Narayana\\AppData\\Local\\Temp\\pip-install-wlypji8s\\pyswisseph\\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\Narayana\AppData\Local\Temp\pip-record-00ch1s58\install-record.txt --single-version-externally-managed --compile:
Searching system libswe...
pkg-config not found
Using internal libswe
c:\users\narayana\appdata\local\programs\python\python37\lib\site-packages\setuptools\dist.py:398: UserWarning: Normalizing '2.00.00-2' to '2.0.0.post2'
normalized_version,
running install
running build
running build_ext
building 'swisseph' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\libswe
creating build\temp.win-amd64-3.7\Release\swephelp
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ilibswe -Iswephelp -Ic:\users\narayana\appdata\local\programs\python\python37\include -Ic:\users\narayana\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\include" /Tcpyswisseph.c /Fobuild\temp.win-amd64-3.7\Release\pyswisseph.obj -std=gnu99
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
pyswisseph.c
c:\users\narayana\appdata\local\programs\python\python37\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
**----------------------------------------
Command "c:\users\narayana\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Narayana\\AppData\\Local\\Temp\\pip-install-wlypji8s\\pyswisseph\\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\Narayana\AppData\Local\Temp\pip-record-00ch1s58\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Narayana\AppData\Local\Temp\pip-install-wlypji8s\pyswisseph\**
C:\WINDOWS\system32>
答案 0 :(得分:1)
不幸的是,通过切换到UNIX-y系统(例如Linux或macOS)(或可能使用了基于GCC的工具链(如Windows上的MinGW))。
该软件包似乎与Windows / Visual Studio不兼容; setup.py
文件充满了仅在UNIX上才有意义的假设。
编辑:该软件包在macOS上可以正常运行:
$ uname -a
Darwin xx 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
$ pip install pyswisseph
Collecting pyswisseph
Downloading... (458kB)
Building wheels for collected packages: pyswisseph
Running setup.py bdist_wheel for pyswisseph ... done
Successfully built pyswisseph
Installing collected packages: pyswisseph
Successfully installed pyswisseph-2.0.0.post2
答案 1 :(得分:0)
最后弄清楚了如何使模块在Windows中工作。我们必须使用非官方的Windows二进制文件,来自 'https://www.lfd.uci.edu/~gohlke/pythonlibs/'。 不同版本的python和模块更新有不同的方向盘。我使用了:pyswisseph‑2.5.1.post0‑cp37‑cp37m‑win_amd64.whl。使用适合您的python / windows版本的轮子 解决方案:您所要做的就是打开命令窗口,键入 'pip install pyswisseph‑2.5.1.post0‑cp37‑cp37m‑win_amd64.whl' 并安装。
答案 2 :(得分:0)
运行pyswisseph软件包的最简单方法是使用免费的Google Colab平台在Ubuntu VM上使用它。有关示例代码,请遵循this link,然后创建您自己的笔记本文件副本,它应该可以工作。