首页 热点资讯 义务教育 高等教育 出国留学 考研考公
您的当前位置:首页正文

记安装pyspectator填坑记

2024-12-20 来源:化拓教育网
  • 原文链接:

记安装填坑记:

Environment INFO:

windows10 + python3.5

1、正常安装

# Run as root user:
pip install -U pyspectator_tornado

Error INFO:

Collecting pyspectator_tornado
  Using cached pyspectator_tornado-1.1.2-py3-none-any.whl
Collecting pyspectator>=1.1.2 (from pyspectator_tornado)
  Using cached pyspectator-1.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    error in pyspectator setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; 
    Invalid requirement, parse error at "'-r base.'"

解决办法:

下载源代码;
打开Setup.py相关联的文件, 找到报错的地方: parse error at "'-r base.'":

直接搜索 base, 然后在“.\pyspectator-1.2.1\requirements”找到:

-r base.txt
wmi >= 1.4.9

直接把第一行删除.

运行 python setup.py install
Finished processing dependencies for pyspectator==1.2.1

安装成功

2、再次运行:

# Run as root user:
pip install -U pyspectator_tornado
Requirement already up-to-date: wmi>=1.4.9 in s:\programdata\anaconda3\envs\tensorflow\lib\site-packages\wmi-1.4.9-py3.5.egg (from pyspectator>=1.1.2->pyspectator_tornado)
Installing collected packages: tornado, pyspectator-tornado
Successfully installed pyspectator-tornado-1.1.2 tornado-5.0.

安装成功

3、运行程序:

How to use
To start working with pyspectator_tornado system you must execute file "start.py" in a root directory of project.

Most simple method, where pyspectator_tornado will be binded on port "8888" and available by address: "localhost:8888":

$ python start.py

4、报错 “ImportError: No module named 'psutil”

安装 psutil:

pip install psutil
Collecting psutil
  Downloading psutil-5.4.5-cp35-cp35m-win_amd64.whl (222kB)
    100% |████████████████████████████████| 225kB 7.1kB/s
Installing collected packages: psutil
Successfully installed psutil-5.4.5

安装成功。

5、重复第三步。

报错:

ImportError: No module named 'pyvalid'

安装:

pip install pyvalid

报错:

  Using cached pyvalid-0.9.tar.bz2
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\zcaoc\AppData\Local\Temp\pip-build-lpgjhgil\pyvalid\setup.py", line 75, in <module>
        main()
      File "C:\Users\zcaoc\AppData\Local\Temp\pip-build-lpgjhgil\pyvalid\setup.py", line 23, in main
        long_description=open('README.rst').read(),
    UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 800: illegal multibyte sequence

6、源码安装 pyvalid:

        #long_description=open('README.rst').read(),
        install_requires=[],
        keywords=[
            'pyvalid', 'valid',
            'validation', 'type',
            'checking', 'check',
            'decorator'
        ],
        platforms='Platform Independent',
        #package_data={
        #    'pyspectator': ['LICENSE', 'README.rst']
        #},

目测,,那个README.rst没什么luan用。所以注释掉没关系;

然后,到目标文件夹运行:

python setup.py install
Installed s:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pyvalid-0.6-py3.5.egg
Processing dependencies for pyvalid==0.6
Finished processing dependencies for pyvalid==0.6

成功安装。

7、重复第三步, 报错:ImportError: No module named 'netifaces'.

pip install netifaces
Collecting netifaces
  Using cached netifaces-0.10.6-cp35-cp35m-win_amd64.whl
Installing collected packages: netifaces
Successfully installed netifaces-0.10.6

成功安装。

8、重复第三步,报错:ImportError: No module named 'win32com'

Successfully installed pywin32-223

成功安装。

9、重复第三步,成功运行。

成功运行

总结:

1、python包的安装,首先使用pip安装,如果安装失败,好好看看报错信息,, 试着利用setup.py安装。

2、实不相瞒,, 为了安个包,, 我也是惊了。

显示全文