Im sorry to ask this question again. I have searched and found endles repeats of it both on * and also on general google search. Unfortunatly I just cant get my system sorted.
我很抱歉再次提出这个问题。我已经搜索并发现它们在*和一般谷歌搜索上重复了它。不幸的是,我不能让我的系统排序。
I have the following:
我有以下内容:
C:\Python27\Lib\site-packages\wx-2.8-msw-unicode
this folder contains the wx folder and also wx & wxPython folders which each contain the _init_.py
files
此文件夹包含wx文件夹以及wx和wxPython文件夹,每个文件夹包含_init_.py文件
When I import wx I get the error message "no module named wx"
当我导入wx时,我收到错误消息“没有名为wx的模块”
What do I need to do in order to get Python to find the relevant files to allow me to "import wx" succesfully
为了让Python找到相关文件以允许我成功地“导入wx”,我需要做些什么
13 个解决方案
#1
20
Ubuntu:
sudo apt-get install python-wxtools
#2
17
Windows:
-
Go to
C:\Python27\Lib\site-packages\
find the folderwx-<version>-msw
or similar转到C:\ Python27 \ Lib \ site-packages \找到文件夹wx-
-msw或类似文件夹 -
Move the
wx
from the above folder toC:\Python27\Lib\site-packages\
将wx从上面的文件夹移动到C:\ Python27 \ Lib \ site-packages \
#3
4
I had the same error today but I tried something and surprisingly it worked. In the site packages folder there will be a file named wx.pth. Open it using notepad and its contents would be like "wx-2.8-msw-unicode"
我今天遇到了同样的错误,但我尝试了一些令人惊讶的工作。在站点包文件夹中,将有一个名为wx.pth的文件。用记事本打开它,其内容就像“wx-2.8-msw-unicode”
It is basically the name of the folder containing wxpython
. Delete this using Ctrl + A and copy the name of the folder from the site packages and paste it here even if it is the same.
它基本上是包含wxpython的文件夹的名称。使用Ctrl + A删除它,并从站点包中复制文件夹的名称,并将其粘贴到此处,即使它是相同的。
Sounds weird but maybe the original file contained a hidden character...
听起来很奇怪,但也许原始文件包含一个隐藏的角色......
#4
3
If you do not have wx installed on windows you can use :
如果你没有在Windows上安装wx,你可以使用:
pip install wx
#5
1
I too face the same problem, I like to share which I was faced so it can be helpful for anyone. In my case I have installed both python2. 7 and python3, and tested the application in python3 after some analysis I used
我也面临同样的问题,我喜欢分享我面对的问题,这对任何人都有帮助。在我的情况下,我已经安装了两个python2。 7和python3,并在我使用的一些分析后测试了python3中的应用程序
pip show wxpython-common
pip show wxpython-common
to find the location of wx which was in
找到wx的位置
/usr/lib/python2.7/dist-packages
so i understood in my case wx will work only in python2.7 environment
所以我理解在我的情况下,wx只能在python2.7环境中工作
#6
1
I had the same problem for a PyMOL plugin that required the wx module, though I installed wxpython by downloading its package from here (Unofficial Windows Binaries for Python Extension Packages) and installing it with the command:
对于需要wx模块的PyMOL插件我遇到了同样的问题,尽管我通过从这里下载其软件包(非扩展的Python扩展软件包的二进制文件)来安装wxpython并使用以下命令安装它:
pip install .\wxPython-3.0.2.0-cp27-none-win_amd64.whl
For some reason it gave me that error, for which I uninstalled it with:
由于某种原因,它给了我这个错误,我为此卸载了它:
pip uninstall wxPython
and then I downloaded it from here (wxPython 4.0.0a1) and reinstalled:
然后我从这里下载它(wxPython 4.0.0a1)并重新安装:
pip install .\wxPython-4.0.0a1-cp27-cp27m-win_amd64.whl
The error at this point has not been presented anymore.
此时的错误已不再出现。
#7
1
In fedora you can use following command
在fedora中,您可以使用以下命令
pip install -U \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \ wxPython
#8
0
You may check if you have the directory where are the packages of Python (in my machine, this dir is C:\Python27\lib\site-packages) in the Path variable on Windows. If Python's path environment variable does not have this directory, you will not find the packages.
您可以在Windows上的Path变量中检查您的目录是否包含Python的包(在我的机器中,此目录是C:\ Python27 \ lib \ site-packages)。如果Python的路径环境变量没有此目录,则无法找到包。
#9
0
I restart the IDLE and works for me!
我重启IDLE并为我工作!
#10
0
I'm on 64-bit Windows 7 and went to:
我在64位Windows 7上,然后去了:
Then downloaded the exe for my system, installed it, and it worked for me.
然后下载了我的系统的exe,安装它,它对我有用。
#11
0
Download the .whl file from this link.
从此链接下载.whl文件。
The name of the file is: wxPython‑3.0.2.0‑cp27‑none‑win32.whl
for Windows 32 bit and python 2.7 and wxPython‑3.0.2.0‑cp27‑none‑win_amd64.whl
for Windows 64 bit and python 2.7.
该文件的名称是:用于Windows 32位的wxPython-3.0.2.0-cp27-none-win32.whl和用于Windows 64位和python 2.7的python 2.7和wxPython-3.0.2.0-cp27-none-win_amd64.whl。
Then in the command prompt: pip install location-of-the-above-saved-file
然后在命令提示符下:pip install-of-above-saved-file
#12
0
Just open your terminal and run this command thats for windows users pip install -U wxPython
只需打开您的终端并运行此命令,即Windows用户pip install -U wxPython
for Ubuntu user you can use this
对于Ubuntu用户,您可以使用它
pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \
wxPython
#13
-3
Generally, package names in the site-packages folder are intended to be imported using the exact name of the module or subfolder.
通常,site-packages文件夹中的包名称旨在使用模块或子文件夹的确切名称导入。
If my site-packages folder has a subfolder named "foobar", I would import that package by typing import foobar
.
如果我的site-packages文件夹有一个名为“foobar”的子文件夹,我会通过输入import foobar导入该包。
One solution might be to rename site-packages\wx-2.8-msw-unicode
to site-packages\wx
.
一种解决方案可能是将site-packages \ wx-2.8-msw-unicode重命名为site-packages \ wx。
Or you could add C:\Python27\Lib\site-packages\wx-2.8-msw-unicode
to your PYTHONPATH environment variable.
或者您可以将C:\ Python27 \ Lib \ site-packages \ wx-2.8-msw-unicode添加到PYTHONPATH环境变量中。
#1
20
Ubuntu:
sudo apt-get install python-wxtools
#2
17
Windows:
-
Go to
C:\Python27\Lib\site-packages\
find the folderwx-<version>-msw
or similar转到C:\ Python27 \ Lib \ site-packages \找到文件夹wx-
-msw或类似文件夹 -
Move the
wx
from the above folder toC:\Python27\Lib\site-packages\
将wx从上面的文件夹移动到C:\ Python27 \ Lib \ site-packages \
#3
4
I had the same error today but I tried something and surprisingly it worked. In the site packages folder there will be a file named wx.pth. Open it using notepad and its contents would be like "wx-2.8-msw-unicode"
我今天遇到了同样的错误,但我尝试了一些令人惊讶的工作。在站点包文件夹中,将有一个名为wx.pth的文件。用记事本打开它,其内容就像“wx-2.8-msw-unicode”
It is basically the name of the folder containing wxpython
. Delete this using Ctrl + A and copy the name of the folder from the site packages and paste it here even if it is the same.
它基本上是包含wxpython的文件夹的名称。使用Ctrl + A删除它,并从站点包中复制文件夹的名称,并将其粘贴到此处,即使它是相同的。
Sounds weird but maybe the original file contained a hidden character...
听起来很奇怪,但也许原始文件包含一个隐藏的角色......
#4
3
If you do not have wx installed on windows you can use :
如果你没有在Windows上安装wx,你可以使用:
pip install wx
#5
1
I too face the same problem, I like to share which I was faced so it can be helpful for anyone. In my case I have installed both python2. 7 and python3, and tested the application in python3 after some analysis I used
我也面临同样的问题,我喜欢分享我面对的问题,这对任何人都有帮助。在我的情况下,我已经安装了两个python2。 7和python3,并在我使用的一些分析后测试了python3中的应用程序
pip show wxpython-common
pip show wxpython-common
to find the location of wx which was in
找到wx的位置
/usr/lib/python2.7/dist-packages
so i understood in my case wx will work only in python2.7 environment
所以我理解在我的情况下,wx只能在python2.7环境中工作
#6
1
I had the same problem for a PyMOL plugin that required the wx module, though I installed wxpython by downloading its package from here (Unofficial Windows Binaries for Python Extension Packages) and installing it with the command:
对于需要wx模块的PyMOL插件我遇到了同样的问题,尽管我通过从这里下载其软件包(非扩展的Python扩展软件包的二进制文件)来安装wxpython并使用以下命令安装它:
pip install .\wxPython-3.0.2.0-cp27-none-win_amd64.whl
For some reason it gave me that error, for which I uninstalled it with:
由于某种原因,它给了我这个错误,我为此卸载了它:
pip uninstall wxPython
and then I downloaded it from here (wxPython 4.0.0a1) and reinstalled:
然后我从这里下载它(wxPython 4.0.0a1)并重新安装:
pip install .\wxPython-4.0.0a1-cp27-cp27m-win_amd64.whl
The error at this point has not been presented anymore.
此时的错误已不再出现。
#7
1
In fedora you can use following command
在fedora中,您可以使用以下命令
pip install -U \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \ wxPython
#8
0
You may check if you have the directory where are the packages of Python (in my machine, this dir is C:\Python27\lib\site-packages) in the Path variable on Windows. If Python's path environment variable does not have this directory, you will not find the packages.
您可以在Windows上的Path变量中检查您的目录是否包含Python的包(在我的机器中,此目录是C:\ Python27 \ lib \ site-packages)。如果Python的路径环境变量没有此目录,则无法找到包。
#9
0
I restart the IDLE and works for me!
我重启IDLE并为我工作!
#10
0
I'm on 64-bit Windows 7 and went to:
我在64位Windows 7上,然后去了:
Then downloaded the exe for my system, installed it, and it worked for me.
然后下载了我的系统的exe,安装它,它对我有用。
#11
0
Download the .whl file from this link.
从此链接下载.whl文件。
The name of the file is: wxPython‑3.0.2.0‑cp27‑none‑win32.whl
for Windows 32 bit and python 2.7 and wxPython‑3.0.2.0‑cp27‑none‑win_amd64.whl
for Windows 64 bit and python 2.7.
该文件的名称是:用于Windows 32位的wxPython-3.0.2.0-cp27-none-win32.whl和用于Windows 64位和python 2.7的python 2.7和wxPython-3.0.2.0-cp27-none-win_amd64.whl。
Then in the command prompt: pip install location-of-the-above-saved-file
然后在命令提示符下:pip install-of-above-saved-file
#12
0
Just open your terminal and run this command thats for windows users pip install -U wxPython
只需打开您的终端并运行此命令,即Windows用户pip install -U wxPython
for Ubuntu user you can use this
对于Ubuntu用户,您可以使用它
pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \
wxPython
#13
-3
Generally, package names in the site-packages folder are intended to be imported using the exact name of the module or subfolder.
通常,site-packages文件夹中的包名称旨在使用模块或子文件夹的确切名称导入。
If my site-packages folder has a subfolder named "foobar", I would import that package by typing import foobar
.
如果我的site-packages文件夹有一个名为“foobar”的子文件夹,我会通过输入import foobar导入该包。
One solution might be to rename site-packages\wx-2.8-msw-unicode
to site-packages\wx
.
一种解决方案可能是将site-packages \ wx-2.8-msw-unicode重命名为site-packages \ wx。
Or you could add C:\Python27\Lib\site-packages\wx-2.8-msw-unicode
to your PYTHONPATH environment variable.
或者您可以将C:\ Python27 \ Lib \ site-packages \ wx-2.8-msw-unicode添加到PYTHONPATH环境变量中。