Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Error : No module named pkg_resources

I would like to use Python3.7 on MacOS

I already Python 2.7 version.

I created an alias on .bash_profile, alias python="/usr/local/bin/python3.7" then source ~/.bash_profile.

So I deleted Python2.7 to /usr/local/lib/

Now, when I try to execute pip install PySide2, I have an error :

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I think this error has happened since I deleted Python2.7

Someone can help me to resolve my error ?

Thank you !

like image 665
Solenne Daguerre Avatar asked Nov 25 '19 16:11

Solenne Daguerre


People also ask

What is Pkg_resources Python?

pkg_resources is a module used to find and manage Python package/version dependencies and access bundled files and resources, including those inside of zipped . egg files.

How do I install Python Setuptools?

Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.


1 Answers

pyinstaller 3.6 is incompatible with setuptools 45.1.0 on python 3.7.*, should be downgraded to 45.0.0

pip install setuptools==45.0.0

can also be fixed with passing/adding hidden_imports 'pkg_resources.py2_warn' to pyinstaller spec

Issue and solutions are tracked here: https://github.com/pypa/setuptools/issues/1963

like image 147
oetzi Avatar answered Sep 21 '22 03:09

oetzi