Reputation: 23
I'm coming from a windows background and am making programs under python 2.7.15 and wxpython 2.8.12.1 for work projects (that is their established configuration).
The learning curve on linux is steep for me. I started by trying to get the same environment on ubuntu.... for many hours. I hate to admit I basically gave up trying to compile my exact version from source after much frustration.
I now simply desire to get started programming with wxpython of any current recommended configuration (python 3.7 and wxpython 4.0 would be fine)
I have Ubuntu 18.04, which comes with python3: 3.6.7. I have python 2.7.15 as well. I also installed python 3.7.2 via sudo apt-get install python3-pip
I use wing IDE on windows so I figured I would do the same on Ubuntu. I am trying to get that going in parallel.
In the meantime I installed PyCharm from the Ubuntu software store.. it is quite a bit different than wing and tries to get me to use virtual environments for projects. I am trying to get it going but I can't seem to line up the environment with the right python / wxpython packages. Even simple code examples don't run.
OK, so can someone help point me towards methods for getting this going? what versions should I use?
Should I use apt-get? should I use pip? This install is just for fun, I want to get programming!
--update: So I got wing going and if I use python3.6 as the environment my "hello world" test with wxpython works fine. if I switch to 3.7 I can't get it to work ("missing _core") and other errors. I guess I need help trying to set up 3.7. Trying to use pip "python3.7 pip install wxpython" gives
Error running configure ERROR: failed building wxWidgets Traceback (most recent call last): File "build.py", line 1321, in cmd_build_wx wxbuild.main(wxDir(), build_options) File "/tmp/pip-build-begnss0_/wxpython/buildtools/build_wxwidgets.py", line 375, in main "Error running configure") File "/tmp/pip-build-begnss0_/wxpython/buildtools/build_wxwidgets.py", line 85, in exitIfError raise builder.BuildError(msg) buildtools.builder.BuildError: Error running configure Finished command: build_wx (0m9.551s) Finished command: build (0m9.551s) Command '"/usr/bin/python3.7" -u build.py build' failed with exit code 1.
---------------------------------------- Command "/usr/bin/python3.7 -u -c "import setuptools,
tokenize;file='/tmp/pip-build-begnss0_/wxpython/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-wfsndtdv-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-begnss0_/wxpython/
Upvotes: 1
Views: 1161
Reputation: 268
An easy way to create virtual environments is pipenv.
sudo pip install pipenv
mkdir test_project
cd test_project
pipenv install packagename
pipenv shell
This will set you in a virtual environment in your current directory, you should see the directory name in parentheses at the beginning of your prompt.
I'm still pretty new to python but this seems like the fastest way to virtual environments, learned it while reading the Django for beginners book.
Upvotes: 0
Reputation: 23
here is what I ended up doing and it now works: Please excuse my "noobishness"
https://linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04/
$sudo apt update
$sudo apt install software-properties-common
$sudo add-apt-repository ppa:deadsnakes/ppa
$sudo apt install python3.7
https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/
$sudo apt install python3-pip
$sudo apt install python-pip
https://wiki.wxpython.org/How%20to%20install%20wxPython
$sudo python3.7 pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \
wxPython
Now install IDE (I chose wing): https://wingware.com/download-file&prod=wingper&target=https://wingware.com/pub/wingide-personal/6.1.4/wingide-personal6_6.1.4-1_amd64.deb
Thanks for the tip on virtual environments, I get it now!
Everything I have seen recommends the creation of virtual environments which I will do if I start a serious project.
Doing it this way and setting wing's project to the 3.7 distribution uses python 3.7.2 and wxpython 4.0.4
3.7.2 (default, Dec 25 2018, 03:50:46)
[GCC 7.3.0]
Python Type "help", "copyright", "credits" or "license" for more information.
import wx
wx.version()
'4.0.4 gtk3 (phoenix) wxWidgets 3.0.5'
import sys
sys.version_info
sys.version_info(major=3, minor=7, micro=2, releaselevel='final', serial=0)
Upvotes: 1
Reputation: 1395
Use apt-get
only to install python and some essential packages (like python-pip and python-dev). Everything else you should install with virtualenv, but if you're not comfortable with this sudo pip
is ok for toy projects. Packages in the official repository could be quite old.
Upvotes: 0