[英]Error while installing statsmodels for python2.7 in windows 7
[英]Getting error while installing OCPP in Python2.7
我正在嘗試使用以下命令在 Python 2.7 中安裝 OCPP 並收到如下所示的錯誤。 請幫忙解決問題
C:\Python27>python -m pip install ocpp
Collecting ocpp
Downloading https://files.pythonhosted.org/packages/36/f8/f3222edf8cf0f1a7373c9d5b0be0974959b3cf302906f0c59fe8bf4071f7/ocpp-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\vijaya~1\appdata\local\temp\pip-build-yaigdj\ocpp\setup.py", line 6, in <module>
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\vijaya~1\appdata\local\temp\pip-build-yaigdj\ocpp\
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
我安裝了python 3.8並重新安裝了OCPP。 之后,我嘗試模擬以下鏈接https://pypi.org/project/ocpp/ 中給出的 PyPi OCPP 的中央系統和充電點。 中央系統代碼運行沒有任何錯誤。 但是在編譯充電點代碼時,我收到以下錯誤
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
====================== RESTART: C:/Python38/ocppserver.py ======================
INFO:root:WebSocket Server Started
====================== RESTART: C:\Python38\chargepoint.py =====================
Traceback (most recent call last):
File "C:\Python38\chargepoint.py", line 39, in <module>
asyncio.run(main())
File "C:\Python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Python38\chargepoint.py", line 28, in main
async with websockets.connect(
File "C:\Python38\lib\site-packages\websockets\client.py", line 517, in __aenter__
return await self
File "C:\Python38\lib\site-packages\websockets\client.py", line 535, in __await_impl__
transport, protocol = await self._create_connection()
File "C:\Python38\lib\asyncio\base_events.py", line 1030, in create_connection
raise exceptions[0]
File "C:\Python38\lib\asyncio\base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "C:\Python38\lib\asyncio\base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "C:\Python38\lib\asyncio\proactor_events.py", line 702, in sock_connect
return await self._proactor.connect(sock, address)
File "C:\Python38\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "C:\Python38\lib\asyncio\windows_events.py", line 595, in finish_connect
ov.getresult()
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection
>>>
[PyPI]: ocpp (目前是v0.8.1 ) 只支持Python 3 。 但是,同樣的事情也適用於v0.1.1 (第一個OCPP版本)。
因此,繼續進行的唯一方法是安裝(並開始使用) Python 3 ,並放棄Python 2(.7) (它從萬能的 2020 年開始就已經死了( [Python]:PEP 373 - Python 2.7 發布時間表)) .
當然,將OCPP代碼移植到Python 2是(痛苦的)替代方案,但我完全反對它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.