Home > Back-end >  How can I ensure my Python packages are installed in Python 3.10 instead of /Library/Python 3.8?
How can I ensure my Python packages are installed in Python 3.10 instead of /Library/Python 3.8?

Time:05-15

I have successfully installed Python 3.10. I want to install packages. Pandas, BeautifulSoup4, and requests.

I tried to import NumPy but IDE says it doesn't have the NumPy module.

I searched for it in directories and it turned out NumPy is in the 3.8 version.

I used the command on the terminal:

sudo python3 -m pip install Pandas

Which installed it successfully.

But the package files are installed in Python 3.8.

Now I have the following Directories:

  • /Library/Python 3.8
  • /Library/Frameworks/Python.framework/Versions 3.10
  • /Applications/Python 3.10
  • /usr/local/bin 3.10

In /Library/Python there is only 2.7 and 3.8 versions

Python 3.8

In following directories version is 3.10:

  • /Library/Frameworks/Python.framework/Versions 3.10
  • /Applications/Python 3.10
  • /usr/local/bin 3.10

/usr/local/bin

/usr/local/bin

/Library/Frameworks/Python.framework/Versions

/Library/Frameworks/Python.framework/Versions

/Applications/Python

/Applications/Python

What will happen if i remove 3.8 or can i update it to 3.10?

CodePudding user response:

Is better to use a virtual environment and install in it python 3.10, removing Python 3.8 can may some problems, so avoid removing it, and if you are open to using different tools, I advise you to use Jupyter Notebook.

CodePudding user response:

I found my answer here: https://stackoverflow.com/a/25123329/13377578

Just had to specify the version of Python I want to install the package in.

sudo python3.10 -m pip install Pandas

Now it works. Thanks.

  • Related