Install pycocotools error TypeError: expected str, bytes or os.PathLike object, not NoneType

one. mistake

The following error is reported when installing pycocotools-2.0.6:

I actually created a new python virtual environment on windows, so I took a look at the pycocotools version of my main environment

It seems that using this version is fine, try again, it still doesn't work. . . :

Then someone on the Internet said that it is possible to use 2.0.2, but there is a problem. 2.0.2 is an ancient version of 20 years, which may cause other incompatibility problems. For example, the numpy version it requires may also have to Very old, if you use a newer numpy version it won't work. But it is possible that your other libraries just need a new numpy version, wouldn't that be a dilemma.

two. solution

The solution is very simple, that is, don't use pip to install it, just download the source code installation package of pycocotools and install it yourself.

Go to pypi to download the source code installation package

pycocotools · PyPI

 Unzip anywhere

Then open the command line, cd to this directory, and execute python setup.py install

In fact, the previous 2.0.4 must have been installed in this way, but it has been too long to forget, so it is better to organize and summarize more when you have time.

three. why

Then why this happens, I actually don’t know very well~~~, it may be that when installing this package with pip, it is executed according to the logic of the Linux environment, but in fact it is the windows environment, resulting in an error in parsing the Path.

 

 

 

 

 

Guess you like

Origin blog.csdn.net/ogebgvictor/article/details/130172913