0

I've been trying to install wxPython in Python27.

I typed below command in Python27 dir, and installed it.

pip install wxPython

enter image description here

I expected the wxPython would be installed in Python27.

But, the wxPython doesn't work in Python27.

When I tried to import the wx, I got below error.

enter image description here

On the other hand, it works for Python3.

How could I get proper wxPython version for Python27?

The installed wx version is this.

enter image description here

This is the result of the command python -m pip install wxPython.

enter image description here

4
  • the wxPython doesn't work is there any error raised? Commented Aug 8, 2019 at 3:19
  • I added the error on python27. Commented Aug 8, 2019 at 3:57
  • 2
    What is the output of the pip command? Are you sure it is the pip from the Python 2.7 installation? One way to be sure is to run it like this: c:\[Python 2.7 Folder]\python -m pip install wxPython Commented Aug 12, 2019 at 16:41
  • I added the result of your comment. One curious thing is pip version is 18.1, while 19.2.1 corresponding to pip install wxPython command. Commented Aug 12, 2019 at 23:52

1 Answer 1

1

Think I understand whats happening now: Your Python 3.7 almost always "wins" against 2.7 (due to the way its installed; we will not know because we cannot see how you activate one over the other according to your screenshots). At any rate, when you do

C:\Python27\python.exe

you will run Python 2.7. However, when you do

C:\Python27\pip

this will call the pip in the 3.7 (!), because it has precedence on %PATH% before the 2.7 one. If you would do C:\Python27\scripts\pip.exe you would call pip/install into 2.7! This is by the way what @RobinDunn suggested! If we look at your newest screenshot, we can see already that both 2.7 and 3.7 have wxPython installed.

So, accordingly, if you try:

C:\Python27\python.exe -c "import wx;print(wx.version())"

you should indeed be able to prove to yourself that the 2.7 has its wx properly running!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.